1
1
import React from 'react'
2
2
import { withA11y } from '@storybook/addon-a11y'
3
- import { withKnobs , text , boolean , select } from " @storybook/addon-knobs"
3
+ import { withKnobs , text , boolean , select } from ' @storybook/addon-knobs'
4
4
import { action } from '@storybook/addon-actions'
5
5
6
6
import Button from '.'
7
7
8
8
export default {
9
9
title : 'Components|Button' ,
10
10
component : Button ,
11
- decorators : [ withA11y , withKnobs ]
11
+ decorators : [ withA11y , withKnobs ] ,
12
12
}
13
13
14
- const variations = [ 'primary' , 'secondary' , 'tertiary' , 'danger' , 'danger-tertiary' , 'inverted-tertiary' ]
14
+ const variations = [
15
+ 'primary' ,
16
+ 'secondary' ,
17
+ 'tertiary' ,
18
+ 'danger' ,
19
+ 'danger-tertiary' ,
20
+ 'inverted-tertiary' ,
21
+ ]
15
22
const sizes = [ 'small' , 'regular' , 'large' ]
16
23
17
24
export const Default = ( ) => (
18
25
< Button
26
+ type = "button"
19
27
variation = { select ( 'Variation' , variations , 'primary' ) }
20
28
isLoading = { boolean ( 'Is loading' , false ) }
21
29
disabled = { boolean ( 'Disabled' , false ) }
@@ -24,14 +32,12 @@ export const Default = () => (
24
32
onClick = { action ( 'button-click' ) }
25
33
onFocus = { action ( 'button-focus' ) }
26
34
>
27
- { text ( " Label" , " With a text" ) }
35
+ { text ( ' Label' , ' With a text' ) }
28
36
</ Button >
29
37
)
30
38
31
39
export const withLoadingState = ( ) => (
32
- < Button
33
- isLoading = { true }
34
- >
40
+ < Button type = "button" isLoading >
35
41
Loading
36
42
</ Button >
37
43
)
@@ -40,16 +46,21 @@ export const withDiffentVariations = () => (
40
46
< >
41
47
{ variations . map ( variation => (
42
48
< >
43
- < Button variation = { variation } > { variation } </ Button >
44
- < br />
45
- < br />
49
+ < Button type = "button" variation = { variation } >
50
+ { variation }
51
+ </ Button >
52
+ < br />
53
+ < br />
46
54
</ >
47
55
) ) }
48
56
</ >
49
57
)
50
58
51
59
export const withOnMouseEvents = ( ) => (
52
60
< Button
61
+ type = "button"
62
+ onFocus = { ( ) => null }
63
+ onBlur = { ( ) => null }
53
64
onMouseDown = { action ( 'button-on-mouse-down' ) }
54
65
onMouseEnter = { action ( 'button-on-mouse-enter' ) }
55
66
onMouseOver = { action ( 'button-on-mouse-over' ) }
@@ -65,9 +76,11 @@ export const withDifferentSizes = () => (
65
76
< >
66
77
{ sizes . map ( size => (
67
78
< >
68
- < Button size = { size } > { size } </ Button >
69
- < br />
70
- < br />
79
+ < Button type = "button" size = { size } >
80
+ { size }
81
+ </ Button >
82
+ < br />
83
+ < br />
71
84
</ >
72
85
) ) }
73
86
</ >
0 commit comments