Skip to content

Commit c83dbcb

Browse files
author
Surdu
committed
Started using knobs
1 parent 3008851 commit c83dbcb

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,57 +1,32 @@
11
import React from "react";
22
import "./../../styles.scss";
33
import { Button } from "./button";
4+
import { withKnobs, text, boolean, select } from "@storybook/addon-knobs";
45

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

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

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

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

0 commit comments

Comments
 (0)