2
2
// documentation of all the Bootstrap classes we have available in our app, please see refer to the Bootstrap
3
3
// documentation for that. Its primary purpose is to show what Bootstrap's componenents look like with our styling
4
4
// customizations.
5
- import { useState } from 'react'
6
-
7
5
import { action } from '@storybook/addon-actions'
8
6
import { DecoratorFn , Meta , Story } from '@storybook/react'
9
- import classNames from 'classnames'
10
7
import 'storybook-addon-designs'
11
8
12
9
import { highlightCodeSafe , registerHighlightContributions } from '@sourcegraph/common'
13
- import {
14
- TextArea ,
15
- Button ,
16
- ButtonGroup ,
17
- Link ,
18
- Select ,
19
- BUTTON_SIZES ,
20
- Checkbox ,
21
- Input ,
22
- Text ,
23
- Code ,
24
- H1 ,
25
- H2 ,
26
- H3 ,
27
- H4 ,
28
- } from '@sourcegraph/wildcard'
10
+ import { TextArea , Button , Link , Select , Checkbox , Input , Text , Code , H1 , H2 , H3 , H4 } from '@sourcegraph/wildcard'
29
11
30
12
import { BrandedStory } from '../../components/BrandedStory'
31
13
import { CodeSnippet } from '../../components/CodeSnippet'
32
14
import { Form } from '../../components/Form'
33
15
34
16
import { ColorVariants } from './ColorVariants'
35
17
import { FormFieldVariants } from './FormFieldVariants'
36
- import { TextStory } from './TextStory'
37
18
import { preventDefault } from './utils'
38
19
39
20
registerHighlightContributions ( )
@@ -53,25 +34,6 @@ const config: Meta = {
53
34
54
35
export default config
55
36
56
- export const TextTypography : Story = ( ) => (
57
- < >
58
- < H1 > Typography</ H1 >
59
-
60
- < TextStory />
61
- </ >
62
- )
63
-
64
- TextTypography . parameters = {
65
- design : {
66
- name : 'Figma' ,
67
- type : 'figma' ,
68
- url :
69
- 'https://www.figma.com/file/NIsN34NH7lPu04olBzddTw/Design-Refresh-Systemization-source-of-truth?node-id=998%3A1515' ,
70
- } ,
71
- }
72
-
73
- type ButtonSizesType = typeof BUTTON_SIZES [ number ] | undefined
74
-
75
37
export const CodeTypography : Story = ( ) => (
76
38
< >
77
39
< H1 > Code</ H1 >
@@ -253,136 +215,6 @@ export const Layout: Story = () => (
253
215
</ >
254
216
)
255
217
256
- export const ButtonGroups : Story = ( ) => {
257
- const [ active , setActive ] = useState < 'Left' | 'Middle' | 'Right' > ( 'Left' )
258
- const buttonSizes : ButtonSizesType [ ] = [ 'lg' , undefined , 'sm' ]
259
- return (
260
- < >
261
- < H1 > Button groups</ H1 >
262
- < Text >
263
- Group a series of buttons together on a single line with the button group.{ ' ' }
264
- < Link to = "https://getbootstrap.com/docs/4.5/components/buttons/" > Bootstrap documentation</ Link >
265
- </ Text >
266
-
267
- < H2 > Example</ H2 >
268
- < div className = "mb-2" >
269
- < Text >
270
- Button groups have no styles on their own, they just group buttons together. This means they can be
271
- used to group any other semantic or outline button variant.
272
- </ Text >
273
- < div className = "mb-2" >
274
- < ButtonGroup aria-label = "Basic example" >
275
- < Button variant = "secondary" > Left</ Button >
276
- < Button variant = "secondary" > Middle</ Button >
277
- < Button variant = "secondary" > Right</ Button >
278
- </ ButtonGroup > { ' ' }
279
- Example with < Code > btn-secondary</ Code >
280
- </ div >
281
- < div className = "mb-2" >
282
- < ButtonGroup aria-label = "Basic example" >
283
- < Button outline = { true } variant = "secondary" >
284
- Left
285
- </ Button >
286
- < Button outline = { true } variant = "secondary" >
287
- Middle
288
- </ Button >
289
- < Button outline = { true } variant = "secondary" >
290
- Right
291
- </ Button >
292
- </ ButtonGroup > { ' ' }
293
- Example with < Code > btn-outline-secondary</ Code >
294
- </ div >
295
- < div className = "mb-2" >
296
- < ButtonGroup aria-label = "Basic example" >
297
- < Button outline = { true } variant = "primary" >
298
- Left
299
- </ Button >
300
- < Button outline = { true } variant = "primary" >
301
- Middle
302
- </ Button >
303
- < Button outline = { true } variant = "primary" >
304
- Right
305
- </ Button >
306
- </ ButtonGroup > { ' ' }
307
- Example with < Code > btn-outline-primary</ Code >
308
- </ div >
309
- </ div >
310
-
311
- < H2 className = "mt-3" > Sizing</ H2 >
312
- < Text >
313
- Just like buttons, button groups have < Code > sm</ Code > and < Code > lg</ Code > size variants.
314
- </ Text >
315
- < div className = "mb-2" >
316
- { buttonSizes . map ( size => (
317
- < div key = { size } className = "mb-2" >
318
- < ButtonGroup aria-label = "Sizing example" >
319
- < Button size = { size } outline = { true } variant = "primary" >
320
- Left
321
- </ Button >
322
- < Button size = { size } outline = { true } variant = "primary" >
323
- Middle
324
- </ Button >
325
- < Button size = { size } outline = { true } variant = "primary" >
326
- Right
327
- </ Button >
328
- </ ButtonGroup >
329
- </ div >
330
- ) ) }
331
- </ div >
332
-
333
- < H2 className = "mt-3" > Active state</ H2 >
334
- < Text >
335
- The < Code > active</ Code > class can be used to craft toggles out of button groups.
336
- </ Text >
337
- < div className = "mb-2" >
338
- < ButtonGroup aria-label = "Basic example" >
339
- { ( [ 'Left' , 'Middle' , 'Right' ] as const ) . map ( option => (
340
- < Button
341
- key = { option }
342
- className = { classNames ( option === active && 'active' ) }
343
- onClick = { ( ) => setActive ( option ) }
344
- aria-pressed = { option === active }
345
- outline = { true }
346
- variant = "secondary"
347
- >
348
- { option }
349
- </ Button >
350
- ) ) }
351
- </ ButtonGroup > { ' ' }
352
- Example with < Code > btn-outline-secondary</ Code >
353
- </ div >
354
- < div className = "mb-2" >
355
- < ButtonGroup aria-label = "Basic example" >
356
- { ( [ 'Left' , 'Middle' , 'Right' ] as const ) . map ( option => (
357
- < Button
358
- key = { option }
359
- className = { classNames ( option === active && 'active' ) }
360
- onClick = { ( ) => setActive ( option ) }
361
- aria-pressed = { option === active }
362
- outline = { true }
363
- variant = "primary"
364
- >
365
- { option }
366
- </ Button >
367
- ) ) }
368
- </ ButtonGroup > { ' ' }
369
- Example with < Code > btn-outline-primary</ Code >
370
- </ div >
371
- </ >
372
- )
373
- }
374
-
375
- ButtonGroups . storyName = 'Button groups'
376
-
377
- ButtonGroups . parameters = {
378
- design : {
379
- type : 'figma' ,
380
- name : 'Figma' ,
381
- url :
382
- 'https://www.figma.com/file/NIsN34NH7lPu04olBzddTw/Design-Refresh-Systemization-source-of-truth?node-id=908%3A2514' ,
383
- } ,
384
- }
385
-
386
218
export const InputGroups : Story = ( ) => (
387
219
< >
388
220
< H1 > Input groups</ H1 >
@@ -613,6 +445,7 @@ export const Meter: Story = args => (
613
445
</ div >
614
446
</ >
615
447
)
448
+
616
449
Meter . argTypes = {
617
450
min : {
618
451
type : 'number' ,
0 commit comments