Skip to content

Commit 04c5b1d

Browse files
author
esuau
committed
Merge branch 'master' of https://github.com/IBM/carbon-components-angular into feat/search
2 parents 0436d72 + ad961d8 commit 04c5b1d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/dialog/overflow-menu/overflow-menu.stories.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
import { storiesOf, moduleMetadata } from "@storybook/angular";
2+
import { withKnobs, boolean, number } from "@storybook/addon-knobs/angular";
23

34
import { DialogModule } from "../../";
45

6+
let options;
7+
8+
function 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+
516
storiesOf("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,21 @@ storiesOf("Overflow Menu", module)
4456
click: () => console.log("click"),
4557
selected: () => console.log("selected")
4658
}
59+
}))
60+
.add("Dynamic", () => ({
61+
template: `
62+
<span>
63+
Dynamic <code style="font-family: monospace;">OverflowMenu</code>, using the <code style="font-family: monospace;">optionCount</code> knob <br/>
64+
to change the number of menu options
65+
</span>
66+
<ibm-overflow-menu>
67+
<ibm-overflow-menu-option *ngFor="let option of options(optionCount)">
68+
{{option}}
69+
</ibm-overflow-menu-option>
70+
</ibm-overflow-menu>
71+
`,
72+
props: {
73+
optionCount: number("optionCount", 10),
74+
options: createOptions
75+
}
4776
}));

0 commit comments

Comments
 (0)