-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathbutton.stories.js
More file actions
75 lines (68 loc) · 1.72 KB
/
button.stories.js
File metadata and controls
75 lines (68 loc) · 1.72 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
import React, { useState } from "react"
import { Button, IconButton, ButtonGroup } from "."
import { iconsList } from "@/components/icon"
const icons = Object.keys(iconsList)
export const Basic = args => <Button {...args} />
export const BaseIconButton = args => (
<IconButton
{...args}
label=""
cursor="pointer"
icon="chevron_left"
iconSize="small"
tooltip="Previous"
/>
)
const radioButtonItems = [
{ label: "One", value: 1 },
{ label: "Two", value: 2 },
{ label: "Three", value: 3 },
]
export const RadioButtonGroup = args => {
const [checked, setChecked] = useState(1)
const onChange = value => setChecked(value)
return (
<ButtonGroup
items={radioButtonItems.map(item => ({ ...args, ...item }))}
checked={checked}
buttonProps={args}
onChange={onChange}
/>
)
}
export default {
component: Button,
tags: ["autodocs"],
args: {
onClick: () => alert("clicked"),
flavour: "default",
id: "some-id",
className: "some-classname",
label: "My button",
loadingLabel: "Loading button",
icon: icons[0],
isLoading: false,
disabled: false,
danger: false,
warning: false,
large: false,
neutral: false,
},
argTypes: {
flavour: {
options: ["default", "hollow", "borderless"],
control: { type: "radio" },
},
id: { control: "text" },
className: { control: "text" },
label: { control: "text" },
loadingLabel: { control: "text" },
icon: { options: icons, type: "select" },
isLoading: { control: "boolean" },
disabled: { control: "boolean" },
danger: { control: "boolean" },
warning: { control: "boolean" },
large: { control: "boolean" },
neutral: { control: "boolean" },
},
}