11import React from 'react' ;
22import { storiesOf } from '@storybook/react' ;
3+ import { action } from '@storybook/addon-actions' ;
4+ import { withKnobs , select } from '@storybook/addon-knobs' ;
35import { defaultTemplate } from '../../../storybook/decorators/storyTemplates' ;
4- import { Button , ButtonGroup } from './index' ;
5- import { Grid , Row , Col } from '../../index' ;
6+ import { Grid , Row , Col , MenuItem } from '../../index' ;
7+ import { Button , ButtonGroup , DropdownButton , SplitButton } from './index' ;
8+ import { BUTTON_BS_STYLES } from './constants' ;
69
710const stories = storiesOf ( 'Button' , module ) ;
811
@@ -16,6 +19,7 @@ const description = (
1619 </ p >
1720) ;
1821
22+ stories . addDecorator ( withKnobs ) ;
1923stories . addDecorator (
2024 defaultTemplate ( {
2125 title : 'Button' ,
@@ -138,3 +142,43 @@ stories.addWithInfo('ButtonGroup', () => {
138142 </ Grid >
139143 ) ;
140144} ) ;
145+
146+ stories . addWithInfo ( 'DropdownButton' , '' , ( ) => {
147+ const bsStyle = select ( 'Style' , BUTTON_BS_STYLES , 'default' ) ;
148+ const bsSize = select ( 'Size' , [ undefined , 'xsmall' , 'small' , 'large' ] ) ;
149+
150+ const props = { bsStyle, title : bsStyle , id : 'dropdown-example' } ;
151+ if ( bsSize ) props . bsSize = bsSize ;
152+
153+ return (
154+ < DropdownButton { ...props } onClick = { action ( 'onClick' ) } >
155+ < MenuItem eventKey = "1" > Action</ MenuItem >
156+ < MenuItem eventKey = "2" > Another action</ MenuItem >
157+ < MenuItem eventKey = "3" active >
158+ Active Item
159+ </ MenuItem >
160+ < MenuItem divider />
161+ < MenuItem eventKey = "4" > Separated link</ MenuItem >
162+ </ DropdownButton >
163+ ) ;
164+ } ) ;
165+
166+ stories . addWithInfo ( 'SplitButton' , '' , ( ) => {
167+ const bsStyle = select ( 'Style' , BUTTON_BS_STYLES , 'default' ) ;
168+ const bsSize = select ( 'Size' , [ undefined , 'xsmall' , 'small' , 'large' ] ) ;
169+
170+ const props = { bsStyle, title : bsStyle , id : 'dropdown-example' } ;
171+ if ( bsSize ) props . bsSize = bsSize ;
172+
173+ return (
174+ < SplitButton { ...props } onClick = { action ( 'onClick' ) } >
175+ < MenuItem eventKey = "1" > Action</ MenuItem >
176+ < MenuItem eventKey = "2" > Another action</ MenuItem >
177+ < MenuItem eventKey = "3" active >
178+ Active Item
179+ </ MenuItem >
180+ < MenuItem divider />
181+ < MenuItem eventKey = "4" > Separated link</ MenuItem >
182+ </ SplitButton >
183+ ) ;
184+ } ) ;
0 commit comments