-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathSpectrumComparison.tsx
More file actions
249 lines (227 loc) · 7.02 KB
/
SpectrumComparison.tsx
File metadata and controls
249 lines (227 loc) · 7.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
/* eslint-disable react/style-prop-object */
import React, { Fragment, useState } from 'react';
// eslint-disable-next-line no-restricted-imports
import {
ActionButton,
Button,
Checkbox,
Flex,
Grid,
Icon,
Item,
Picker,
type SpectrumButtonProps,
TextField,
} from '@adobe/react-spectrum';
import {
Button as BootstrapButtonOld,
Checkbox as CheckboxOld,
Select,
View,
Text,
} from '@deephaven/components';
import { EMPTY_FUNCTION } from '@deephaven/utils';
import { vsPlay } from '@deephaven/icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {
SAMPLE_SECTION_E2E_IGNORE,
SPECTRUM_COMPARISON_SAMPLES_ID,
} from './constants';
import SampleSection from './SampleSection';
type BootstrapLevel = 'primary' | 'secondary' | 'danger';
const buttons: [BootstrapLevel, SpectrumButtonProps['variant']][] = [
['primary', 'accent'],
['secondary', 'primary'],
['danger', 'negative'],
];
export function SpectrumComparison(): JSX.Element {
const [isChecked, setIsChecked] = useState(false);
return (
<SampleSection
name={SPECTRUM_COMPARISON_SAMPLES_ID}
className={SAMPLE_SECTION_E2E_IGNORE}
>
<h2 className="ui-title" data-no-menu>
Bootstrap / Spectrum Comparison
</h2>
<Flex gap={20} wrap>
<View>
<h3>Buttons - Filled</h3>
<Grid
gap={20}
columns="repeat(2, 120px)"
autoRows="40x"
justifyItems="start"
alignItems="start"
>
<label>Bootstrap</label>
<label>Spectrum</label>
{buttons.map(([level, variant]) => (
<Fragment key={level}>
<BootstrapButtonOld
onClick={EMPTY_FUNCTION}
kind={level}
icon={vsPlay}
>
Button
</BootstrapButtonOld>
<Button variant={variant} style="fill">
<Icon>
<FontAwesomeIcon icon={vsPlay} />
</Icon>
<Text>Button</Text>
</Button>
</Fragment>
))}
<BootstrapButtonOld
onClick={EMPTY_FUNCTION}
kind="primary"
disabled
>
Disabled
</BootstrapButtonOld>
<Button variant="accent" style="fill" isDisabled>
Disabled
</Button>
</Grid>
</View>
<View>
<h3>Buttons - Outline</h3>
<Grid gap={20} columns="repeat(2, 120px)">
<label>Bootstrap</label>
<label>Spectrum</label>
{buttons.map(([level, variant]) => (
<Fragment key={level}>
<BootstrapButtonOld onClick={EMPTY_FUNCTION} kind={level}>
{level}
</BootstrapButtonOld>
<Button variant={variant} style="outline">
{variant}
</Button>
</Fragment>
))}
<BootstrapButtonOld
onClick={EMPTY_FUNCTION}
kind="secondary"
disabled
>
Disabled
</BootstrapButtonOld>
<Button variant="primary" style="outline" isDisabled>
Disabled
</Button>
</Grid>
</View>
<View>
<h3>Action Buttons</h3>
<Grid gap={20} columns="repeat(2, 120px)" autoRows="40x">
<label>Bootstrap</label>
<label>Spectrum</label>
<BootstrapButtonOld onClick={EMPTY_FUNCTION} kind="inline">
Inline
</BootstrapButtonOld>
<ActionButton>Action</ActionButton>
<BootstrapButtonOld onClick={EMPTY_FUNCTION} kind="inline" disabled>
Disabled
</BootstrapButtonOld>
<ActionButton isDisabled>Disabled</ActionButton>
</Grid>
</View>
<View>
<h3>Pickers</h3>
<Grid gap={20} columns="repeat(2, 192px)" autoRows="40x">
<label>Bootstrap</label>
<label>Spectrum</label>
{[false, true].map(isDisabled => (
<Fragment key={String(isDisabled)}>
<div>
<label className="input-label">Select</label>
<Select
disabled={isDisabled}
placeholder="Select"
onChange={_v => {
// no-op
}}
className="custom-select"
>
<option disabled value="0">
{isDisabled ? '' : 'Disabled '}Select
</option>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</Select>
</div>
<Picker
isDisabled={isDisabled}
label={isDisabled ? 'Disabled Picker' : 'Picker'}
placeholder="Picker"
>
<Item key="1">One</Item>
<Item key="2">Two</Item>
<Item key="3">Three</Item>
</Picker>
</Fragment>
))}
</Grid>
</View>
<View>
<h3>Text Field</h3>
<Grid gap={20} columns="repeat(2, 192px)" autoRows="40x">
<label>Bootstrap</label>
<label>Spectrum</label>
<div>
<label className="input-label">type=text</label>
<input
type="text"
className="form-control"
placeholder="Text Input"
/>
</div>
<TextField type="text" label="TextField" />
<div>
<label className="input-label">Disabled</label>
<input
type="text"
className="form-control"
disabled
value="Disabled"
/>
</div>
<TextField
type="text"
label="Disabled"
isDisabled
value="Disabled"
/>
</Grid>
</View>
<View>
<h3>Checkbox</h3>
<Grid gap={20} columns="repeat(2, 120px)">
<label>Bootstrap</label>
<label>Spectrum</label>
<CheckboxOld
className="form-group"
checked={isChecked}
onChange={() => setIsChecked(v => !v)}
>
Checkbox
</CheckboxOld>
<Checkbox>Checkbox</Checkbox>
<CheckboxOld
className="form-group"
disabled
checked={isChecked}
onChange={() => setIsChecked(v => !v)}
>
Disabled
</CheckboxOld>
<Checkbox isDisabled>Disabled</Checkbox>
</Grid>
</View>
</Flex>
</SampleSection>
);
}
export default SpectrumComparison;