Skip to content

Commit d077924

Browse files
And new story variant 'indropdown'.
1 parent 31a8a33 commit d077924

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

scss/bitstyles/atoms/dropdown/Dropdown.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ export default ({ alignment = [], children }) => {
1111
});
1212
wrapper.appendChild(button);
1313
const dropdown = document.createElement('div');
14-
dropdown.innerHTML = children || 'Dropdown';
14+
if (children instanceof HTMLElement) {
15+
dropdown.append(children);
16+
} else {
17+
dropdown.innerHTML = children || 'Dropdown';
18+
}
1519
dropdown.classList.add('a-dropdown', 'u-overflow-y-auto');
1620
alignment.forEach((variant) => {
1721
dropdown.classList.add(`a-dropdown--${variant}`);

scss/bitstyles/atoms/flash/flash.stories.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Dropdown from '../dropdown/Dropdown';
12
import Flash from './Flash';
23

34
export default {
@@ -32,6 +33,41 @@ export default {
3233

3334
const Template = (args) => Flash(args);
3435
const dummyOnClick = () => {};
36+
const dropdownDecorator = (story) => {
37+
const render = `
38+
<ul class="u-list-none">
39+
<li>${story().outerHTML}</li>
40+
<li>${
41+
story({
42+
args: {
43+
onClick: dummyOnClick,
44+
icon: 'question-circle',
45+
theme: 'warning',
46+
},
47+
}).outerHTML
48+
}</li>
49+
<li>${
50+
story({
51+
args: {
52+
onClick: dummyOnClick,
53+
icon: 'question-circle',
54+
theme: 'danger',
55+
},
56+
}).outerHTML
57+
}</li>
58+
<li>${
59+
story({
60+
args: {
61+
onClick: dummyOnClick,
62+
icon: 'question-circle',
63+
theme: 'positive',
64+
},
65+
}).outerHTML
66+
}</li>
67+
</ul>
68+
`;
69+
return Dropdown({ children: render });
70+
};
3571

3672
// ***** Theme variants ****************** //
3773

@@ -41,6 +77,7 @@ Base.parameters = {
4177
zeplinLink:
4278
'https://app.zeplin.io/styleguide/63079b90d0bf4a646c46c227/components?coid=6331bd93290bbf15ece3af28',
4379
};
80+
Base.decorators = [dropdownDecorator];
4481

4582
export const Danger = Template.bind({});
4683
Danger.args = { theme: 'danger' };
@@ -134,3 +171,14 @@ PositiveIconButton.parameters = {
134171
zeplinLink:
135172
'https://app.zeplin.io/styleguide/63079b90d0bf4a646c46c227/components?coid=6331bd96d1e9ea1a4033367b',
136173
};
174+
175+
export const InDropdown = Template.bind({});
176+
InDropdown.args = {
177+
icon: 'info-circle',
178+
onClick: dummyOnClick,
179+
children: 'In dropdown',
180+
};
181+
InDropdown.parameters = {
182+
zeplinLink: 'https://zpl.io/8lBBP44',
183+
};
184+
InDropdown.decorators = [dropdownDecorator];

0 commit comments

Comments
 (0)