-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathButton.story.js
70 lines (69 loc) · 2.05 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
import React from "react";
/* eslint-disable import/no-extraneous-dependencies */
import { storiesOf } from "@storybook/react";
import { action } from "@storybook/addon-actions";
import { checkA11y } from "@storybook/addon-a11y";
import { withKnobs, text, color, select } from "@storybook/addon-knobs";
import notes from "./button.notes.md";
import { Button } from "../src";
import { storybookStyles } from "./storyStyles";
export default () =>
storiesOf("Component Lib/Basic Inputs/Button", module)
.addDecorator(withKnobs)
.addDecorator(checkA11y)
.addDecorator(story => (
<div style={storybookStyles.storyGrid}>
<div style={storybookStyles.storyGridItem}>{story()}</div>
</div>
))
.add(
"Standard",
() => {
const label = text("Label", "Hello CIVIC");
return <Button onClick={action("clicked")}>{label}</Button>;
},
{ notes }
)
.add(
"Custom",
() => {
const transitionOptions = {
Standard: "all .2s ease-in-out",
Slow: "all .6s ease-in-out",
Fast: "all .1s ease-in-out"
};
const label = text("Label", "Hello CIVIC");
const accentColor = color("Text & border color", "#DC4556");
const bkgndColor = color("Background color", "#FFFFFF");
const transition = select(
"Transition",
transitionOptions,
"all .2s ease-in-out"
);
return (
<Button
onClick={action("clicked")}
accentColor={accentColor}
bkgndColor={bkgndColor}
transition={transition}
>
{label}
</Button>
);
},
{ notes }
)
.add(
"Example: Non-text label",
() => {
const label = text("Emoji label", "😀 😎 👍 💯");
const ariaLabel = text("aria-label", "So cool");
return (
<Button onClick={action("clicked")}>
{label}
<span role="img" aria-label={ariaLabel} />
</Button>
);
},
{ notes }
);