Skip to content

Commit 367a4a8

Browse files
author
Surdu
committed
Started using knobs
1 parent 049ffbf commit 367a4a8

1 file changed

Lines changed: 17 additions & 42 deletions

File tree

Lines changed: 17 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,31 @@
11
import React from "react";
22
import { Button } from "./button";
3+
import { withKnobs, text, boolean, select } from "@storybook/addon-knobs";
34

4-
export default { title: "Button" };
5+
export default {
6+
title: "Button",
7+
decorators: [withKnobs]
8+
};
59

610
function sayMyName() {
711
alert("Hello Friend");
812
}
913

10-
export const primary = () => {
11-
return (
12-
<Button color="primary" onClick={sayMyName}>
13-
Hello Friend
14-
</Button>
15-
);
16-
};
17-
18-
export const inverted = () => {
19-
return (
20-
<Button inverted={true} onClick={sayMyName}>
21-
Hello Friend
22-
</Button>
23-
);
24-
};
25-
26-
export const disabled = () => {
27-
return (
28-
<Button disabled={true} onClick={sayMyName}>
29-
Hello Friend
30-
</Button>
31-
);
32-
};
33-
34-
export const disabledAndInverted = () => {
35-
return (
36-
<Button disabled={true} inverted={true} onClick={sayMyName}>
37-
Hello Friend
38-
</Button>
39-
);
14+
const typeOptions = {
15+
Primary: "primary",
16+
Danger: "danger",
17+
Warning: "warning"
4018
};
4119

42-
export const danger = () => {
43-
return (
44-
<Button color="danger" onClick={sayMyName}>
45-
Hello Friend
46-
</Button>
47-
);
48-
};
49-
50-
export const warning = () => {
20+
export const primary = () => {
5121
return (
52-
<Button color="warning" onClick={sayMyName}>
53-
Hello Friend
22+
<Button
23+
inverted={boolean("Inverted", false)}
24+
disabled={boolean("Disabled", false)}
25+
type={select("Type", typeOptions, "primary")}
26+
onClick={sayMyName}
27+
>
28+
{text("Text", "Hello Friend")}
5429
</Button>
5530
);
5631
};

0 commit comments

Comments
 (0)