Skip to content

Commit dac7375

Browse files
committed
Tag story: add control for font size
1 parent df82d66 commit dac7375

File tree

1 file changed

+10
-30
lines changed

1 file changed

+10
-30
lines changed

packages/uui-tag/lib/uui-tag.story.ts

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default {
1010
id: 'uui-tag',
1111
args: {
1212
look: '',
13+
fontSize: 12,
1314
slot: 'Hello',
1415
},
1516
argTypes: {
@@ -26,24 +27,18 @@ export default {
2627
],
2728
},
2829
'--uui-tag-font-size': { control: { type: 'text' } },
30+
fontSize: { table: { category: 'Styles' } },
2931
},
3032
};
3133

32-
const tagSizes = ['9px', '12px', '15px', '18px'];
33-
3434
const Template: Story = props => html`
35-
<uui-tag .look=${props.look}>${props.slot}</uui-tag>
35+
<uui-tag look=${props.look} style="font-size: ${props.fontSize}px;"
36+
>${props.slot}</uui-tag
37+
>
3638
`;
3739

3840
export const AAAOverview = Template.bind({});
3941
AAAOverview.storyName = 'Overview';
40-
AAAOverview.parameters = {
41-
docs: {
42-
source: {
43-
code: `<uui-tag>Hello</uui-tag>`,
44-
},
45-
},
46-
};
4742

4843
export const Looks: Story = () =>
4944
html`
@@ -68,30 +63,15 @@ Looks.parameters = {
6863
},
6964
};
7065

71-
export const Sizing: Story = () =>
66+
export const Sizing: Story = props =>
7267
html`
73-
${tagSizes.map(
74-
size =>
75-
html`<uui-tag style="font-size:${size};" look="primary"
76-
>${size}</uui-tag
77-
>`
78-
)}
68+
<uui-tag style="font-size:${props.fontSize}px;" look="primary"
69+
>${props.slot}</uui-tag
70+
>
7971
`;
8072

8173
Sizing.parameters = {
82-
controls: {
83-
include: ['look'],
84-
},
85-
docs: {
86-
source: {
87-
code: `
88-
<uui-tag style="font-size:9px;" look="primary">9px</uui-tag>
89-
<uui-tag style="font-size:12px;" look="primary">12px</uui-tag>
90-
<uui-tag style="font-size:15px;" look="primary">15px</uui-tag>
91-
<uui-tag style="font-size:18px;" look="primary">18px</uui-tag>
92-
`,
93-
},
94-
},
74+
controls: { include: ['fontSize', 'slot'] },
9575
};
9676

9777
// - Would you ever put a button inside a tag? - asked Jesper.

0 commit comments

Comments
 (0)