File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import React from "react" ;
22import { 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
610function 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} ;
You can’t perform that action at this time.
0 commit comments