File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 11import { storiesOf , moduleMetadata } from "@storybook/angular" ;
2+ import { withKnobs , boolean , number } from "@storybook/addon-knobs/angular" ;
23
34import { DialogModule } from "../../" ;
45
6+ let options ;
7+
8+ cost createOptions = ( count : number ) : Array < string > => {
9+ if ( options && count === options . length ) {
10+ return options ;
11+ }
12+ options = Array ( count ) . fill ( 0 ) . map ( ( x , i ) => "Option " + ( i + 1 ) ) ;
13+ return options ;
14+ } ;
15+
516storiesOf ( "Overflow Menu" , module )
617 . addDecorator (
718 moduleMetadata ( {
@@ -10,6 +21,7 @@ storiesOf("Overflow Menu", module)
1021 ]
1122 } )
1223 )
24+ . addDecorator ( withKnobs )
1325 . add ( "Basic" , ( ) => ( {
1426 template : `
1527 <ibm-overflow-menu>
@@ -44,4 +56,18 @@ storiesOf("Overflow Menu", module)
4456 click : ( ) => console . log ( "click" ) ,
4557 selected : ( ) => console . log ( "selected" )
4658 }
59+ } ) )
60+ . add ( "Dynamic" , ( ) => ( {
61+ template : `
62+ <span>Dynamic OverflowMenu, using the optionCount knob to change the number of menu options</span>
63+ <ibm-overflow-menu>
64+ <ibm-overflow-menu-option *ngFor="let option of options(optionCount)">
65+ {{option}}
66+ </ibm-overflow-menu-option>
67+ </ibm-overflow-menu>
68+ ` ,
69+ props : {
70+ optionCount : number ( "optionCount" , 10 ) ,
71+ options : createOptions
72+ }
4773 } ) ) ;
You can’t perform that action at this time.
0 commit comments