Skip to content

Commit 5966e68

Browse files
docs: remove static container in favor of using decorator
1 parent 1ebf8c9 commit 5966e68

File tree

1 file changed

+13
-41
lines changed

1 file changed

+13
-41
lines changed

second-gen/packages/swc/components/divider/stories/divider.stories.ts

Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13-
import { html, TemplateResult } from 'lit';
14-
import { styleMap } from 'lit/directives/style-map.js';
13+
import { html } from 'lit';
1514
import type { Meta, StoryObj as Story } from '@storybook/web-components';
1615
import { getStorybookHelpers } from '@wc-toolkit/storybook-helpers';
1716

@@ -130,53 +129,26 @@ export const StaticBlack: Story = {
130129
args: {
131130
'static-color': 'black',
132131
},
133-
render: (args: Record<string, unknown>) =>
134-
STATIC_CONTAINER(
135-
DIVIDER_VALID_SIZES.map((size) =>
132+
render: (args: Record<string, unknown>) => html`
133+
<div style="display: flex; gap: 24px; align-items: center;">
134+
${DIVIDER_VALID_SIZES.map((size) =>
136135
template({ ...args, size: size as DividerSize })
137-
),
138-
args['static-color'] as string
139-
),
136+
)}
137+
</div>
138+
`,
140139
tags: ['!dev'],
141140
};
142141

143142
export const StaticWhite: Story = {
144143
args: {
145144
'static-color': 'white',
146145
},
147-
render: (args: Record<string, unknown>) =>
148-
STATIC_CONTAINER(
149-
DIVIDER_VALID_SIZES.map((size) =>
146+
render: (args: Record<string, unknown>) => html`
147+
<div style="display: flex; gap: 24px; align-items: center;">
148+
${DIVIDER_VALID_SIZES.map((size) =>
150149
template({ ...args, size: size as DividerSize })
151-
),
152-
args['static-color'] as string
153-
),
150+
)}
151+
</div>
152+
`,
154153
tags: ['!dev'],
155154
};
156-
157-
/* @todo this pattern could be repeated for other static backgrounds and might be pulled into a decorator */
158-
function STATIC_CONTAINER(
159-
content: TemplateResult[],
160-
staticColor?: string
161-
): TemplateResult {
162-
let background = '';
163-
164-
if (staticColor === 'white') {
165-
background = 'linear-gradient(45deg, rgb(64 0 22), rgb(14 24 67))';
166-
} else if (staticColor === 'black') {
167-
background =
168-
'linear-gradient(45deg, rgb(255 241 246), rgb(238 245 255))';
169-
}
170-
171-
return html`<div
172-
style=${styleMap({
173-
background,
174-
padding: '24px',
175-
display: 'flex',
176-
gap: '24px',
177-
'align-items': 'center',
178-
})}
179-
>
180-
${content}
181-
</div>`;
182-
}

0 commit comments

Comments
 (0)