Skip to content

Commit 2358479

Browse files
authored
Feature/2517 tag - improve storybook hierarchy (#2848)
* tag structure in storybook changes, tag 'All' story added to chromatic * cleanup
1 parent 7173bbb commit 2358479

File tree

4 files changed

+65
-53
lines changed

4 files changed

+65
-53
lines changed

chromatic/.storybook/stories/all.stories.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { All as AllSelect } from '../../../packages/components/select/src/select
1919
import { All as AllSkeleton } from '../../../packages/components/skeleton/src/skeleton.stories';
2020
import { All as AllSpinner } from '../../../packages/components/spinner/src/spinner.stories';
2121
import { All as AllSwitch } from '../../../packages/components/switch/src/switch.stories';
22+
import { All as AllTag } from '../../../packages/components/tag/src/root.stories';
2223
import { All as AllTextArea } from '../../../packages/components/text-area/src/text-area.stories';
2324
import { All as AllTextField } from '../../../packages/components/text-field/src/text-field.stories';
2425
import { All as AllToggleButton } from '../../../packages/components/toggle-button/src/toggle-button.stories';
@@ -83,6 +84,7 @@ export const Select = { render: AllSelect.render };
8384
export const Skeleton = { render: AllSkeleton.render };
8485
export const Spinner = { render: AllSpinner.render };
8586
export const Switch = { render: AllSwitch.render };
87+
export const Tag = { render: AllTag.render };
8688
export const TextArea = { render: AllTextArea.render };
8789
export const TextField = { render: AllTextField.render };
8890
export const ToggleButton = { render: AllToggleButton.render };
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { type Meta, type StoryObj } from '@storybook/web-components-vite';
2+
import { html } from 'lit';
3+
import '../register.js';
4+
5+
type Story = StoryObj;
6+
7+
export default {
8+
title: 'Feedback & status/Tag',
9+
tags: ['preview']
10+
} as Meta;
11+
12+
export const All: Story = {
13+
render: () => {
14+
return html`
15+
<style>
16+
.wrapper {
17+
align-items: center;
18+
display: inline-grid;
19+
grid-template-columns: auto 1fr 1fr 1fr 1fr;
20+
gap: 1rem;
21+
justify-items: center;
22+
}
23+
</style>
24+
<div class="wrapper">
25+
<span></span>
26+
<span style="justify-self: center; grid-column: 2 / 4">md</span>
27+
<span style="justify-self: center; grid-column: 4 / 6">lg</span>
28+
29+
<span></span>
30+
<span>default</span>
31+
<span>info</span>
32+
<span>default</span>
33+
<span>info</span>
34+
35+
<span>Default</span>
36+
<sl-tag>Label</sl-tag>
37+
<sl-tag variant="info">Label</sl-tag>
38+
<sl-tag size="lg">Label</sl-tag>
39+
<sl-tag size="lg" variant="info">Label</sl-tag>
40+
41+
<span>Overflow</span>
42+
<sl-tag style="max-inline-size: 100px">Overflow label</sl-tag>
43+
<sl-tag style="max-inline-size: 100px" variant="info">Overflow label</sl-tag>
44+
<sl-tag size="lg" style="max-inline-size: 100px">Overflow label</sl-tag>
45+
<sl-tag size="lg" style="max-inline-size: 100px" variant="info">Overflow label</sl-tag>
46+
47+
<span>Removable</span>
48+
<sl-tag removable>Removable</sl-tag>
49+
<sl-tag removable variant="info">Removable</sl-tag>
50+
<sl-tag removable size="lg">Removable</sl-tag>
51+
<sl-tag removable size="lg" variant="info">Removable</sl-tag>
52+
53+
<span>Disabled</span>
54+
<sl-tag disabled>Disabled</sl-tag>
55+
<sl-tag disabled variant="info">Disabled</sl-tag>
56+
<sl-tag size="lg" disabled>Disabled</sl-tag>
57+
<sl-tag size="lg" disabled variant="info">Disabled</sl-tag>
58+
</div>
59+
`;
60+
}
61+
};

packages/components/tag/src/tag-list.stories.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type Props = Pick<TagList, 'size' | 'stacked' | 'variant'> & {
1313
type Story = StoryObj<Props>;
1414

1515
export default {
16-
title: 'Feedback & status/Tag list',
16+
title: 'Feedback & status/Tag/Tag list',
1717
tags: ['preview'],
1818
args: {
1919
count: 50,

packages/components/tag/src/tag.stories.ts

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type Props = Pick<Tag, 'disabled' | 'label' | 'removable' | 'size' | 'variant'>
1111
type Story = StoryObj<Props>;
1212

1313
export default {
14-
title: 'Feedback & status/Tag',
14+
title: 'Feedback & status/Tag/Tag',
1515
tags: ['preview'],
1616
parameters: {
1717
a11y: {
@@ -79,54 +79,3 @@ export const Removable: Story = {
7979
removable: true
8080
}
8181
};
82-
83-
export const All: Story = {
84-
render: () => {
85-
return html`
86-
<style>
87-
.wrapper {
88-
align-items: center;
89-
display: inline-grid;
90-
grid-template-columns: auto 1fr 1fr 1fr 1fr;
91-
gap: 1rem;
92-
justify-items: center;
93-
}
94-
</style>
95-
<div class="wrapper">
96-
<span></span>
97-
<span style="justify-self: center; grid-column: 2 / 4">md</span>
98-
<span style="justify-self: center; grid-column: 4 / 6">lg</span>
99-
100-
<span></span>
101-
<span>default</span>
102-
<span>info</span>
103-
<span>default</span>
104-
<span>info</span>
105-
106-
<span>Default</span>
107-
<sl-tag>Label</sl-tag>
108-
<sl-tag variant="info">Label</sl-tag>
109-
<sl-tag size="lg">Label</sl-tag>
110-
<sl-tag size="lg" variant="info">Label</sl-tag>
111-
112-
<span>Overflow</span>
113-
<sl-tag style="max-inline-size: 100px">Overflow label</sl-tag>
114-
<sl-tag style="max-inline-size: 100px" variant="info">Overflow label</sl-tag>
115-
<sl-tag size="lg" style="max-inline-size: 100px">Overflow label</sl-tag>
116-
<sl-tag size="lg" style="max-inline-size: 100px" variant="info">Overflow label</sl-tag>
117-
118-
<span>Removable</span>
119-
<sl-tag removable>Removable</sl-tag>
120-
<sl-tag removable variant="info">Removable</sl-tag>
121-
<sl-tag removable size="lg">Removable</sl-tag>
122-
<sl-tag removable size="lg" variant="info">Removable</sl-tag>
123-
124-
<span>Disabled</span>
125-
<sl-tag disabled>Disabled</sl-tag>
126-
<sl-tag disabled variant="info">Disabled</sl-tag>
127-
<sl-tag size="lg" disabled>Disabled</sl-tag>
128-
<sl-tag size="lg" disabled variant="info">Disabled</sl-tag>
129-
</div>
130-
`;
131-
}
132-
};

0 commit comments

Comments
 (0)