This repository has been archived by the owner on Oct 19, 2021. It is now read-only.
/
Button-story.js
194 lines (189 loc) · 5.95 KB
/
Button-story.js
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
import React from 'react';
import { storiesOf, action } from '@storybook/react';
import Button from '../Button';
const buttonEvents = {
onClick: action('onClick'),
onFocus: action('onFocus'),
className: 'some-class',
};
storiesOf('Buttons', module)
.addWithInfo(
'Primary Buttons',
`
Buttons are used to initialize an action, either in the background or
foreground of an experience.
Primary buttons should be used for the principle call to action
on the page. Modify the behavior of the button by changing its event properties.
Small buttons may be used when there is not enough space for a
regular sized button. This issue is most found in tables. Small button should have three words
or less.
The example below shows Primary Button component .
`,
() =>
<div>
<Button {...buttonEvents} className="some-class">
Primary Button
</Button>
<Button {...buttonEvents} href="#" className="some-class">Primary Link</Button>
</div>
)
.addWithInfo(
'Secondary Buttons',
`
Buttons are used to initialize an action, either in the background or
foreground of an experience. Secondary buttons should be used for secondary actions on each page.
Modify the behavior of the button by changing its property events.
The example below shows a Secondary Button component.
`,
() =>
<div>
<Button kind="secondary" {...buttonEvents} className="some-class">
Secondary Button
</Button>
<Button kind="secondary" {...buttonEvents} href="#" className="some-class">
Secondary Link
</Button>
</div>
)
.addWithInfo(
'Small Buttons',
`
Small buttons may be used when there is not enough vertical space for a regular sized button. This issue is most
commonly found in tables. Small buttons should have three words or less.
`,
() =>
<div>
<Button small {...buttonEvents} className="some-class">
Small Primary Button
</Button>
<Button small {...buttonEvents} kind="secondary">Small Secondary Button</Button>
<Button small {...buttonEvents} kind="ghost" icon="add--glyph" iconDescription="Add">
Small Ghost Button
</Button>
<Button small {...buttonEvents} kind="danger">Small Danger Button</Button>
<Button small {...buttonEvents} href="#" className="some-class">
Small Primary Link
</Button>
</div>
)
.addWithInfo(
'Disabled Button',
`
Disabled Buttons may be used when the user cannot proceed until input is collected.
`,
() =>
<div>
<Button {...buttonEvents} disabled>Disabled</Button>
</div>
)
.addWithInfo(
'Button with Icon',
`
When words are not enough, icons can be used in buttons to better communicate what the button does. Icons are
always paired with text.
`,
() =>
<div>
<Button icon="search--glyph" iconDescription="Search" {...buttonEvents}>
With an Icon
</Button>
<Button
kind="secondary"
icon="search--glyph"
iconDescription="Search"
{...buttonEvents}
>
With an Icon
</Button>
<Button
small
kind="primary"
icon="search--glyph"
iconDescription="Search"
{...buttonEvents}
>
With an Icon
</Button>
<Button
small
kind="secondary"
icon="search--glyph"
iconDescription="Search"
{...buttonEvents}
>
With an Icon
</Button>
</div>
)
.addWithInfo(
'Ghost Buttons',
`
Buttons are used to initialize an action, either in the background or
foreground of an experience. Danger buttons should be used for a negative action (such as Delete)
on the page. Modify the behavior of the button by changing its event properties. The example below
shows an enabled Danger Button component.
`,
() =>
<div>
<Button
kind="ghost"
className="some-class"
icon="add--glyph"
iconDescription="Add"
{...buttonEvents}
>
Ghost Button
</Button>
<Button
kind="ghost"
href="#"
className="some-class"
icon="add--glyph"
iconDescription="Add"
{...buttonEvents}
>
Ghost Link
</Button>
</div>
)
.addWithInfo(
'Danger Buttons',
`
Buttons are used to initialize an action, either in the background or
foreground of an experience. Danger buttons should be used for a negative action (such as Delete)
on the page. Modify the behavior of the button by changing its event properties. The example below
shows an enabled Danger Button component.
`,
() =>
<div>
<Button kind="danger" {...buttonEvents} className="some-class">
Danger Button
</Button>
<Button kind="danger" {...buttonEvents} href="#" className="some-class">
Danger Link
</Button>
</div>
)
.addWithInfo(
'Sets of Buttons',
`
When an action required by the user has more than one option, always use a a negative action button (secondary) paired with a positive action button (primary) in that order. Negative action buttons will be on the left. Positive action buttons should be on the right. When these two types buttons are paired in the correct order, they will automatically space themselves apart.
`,
() =>
<div>
<Button kind="secondary" {...buttonEvents} className="some-class">Negative</Button>
<Button kind="primary" {...buttonEvents} className="some-class">Positive</Button>
</div>
);