|
10 | 10 | * governing permissions and limitations under the License. |
11 | 11 | */ |
12 | 12 |
|
13 | | -import { html, TemplateResult } from 'lit'; |
14 | | -import { styleMap } from 'lit/directives/style-map.js'; |
| 13 | +import { html } from 'lit'; |
15 | 14 | import type { Meta, StoryObj as Story } from '@storybook/web-components'; |
16 | 15 | import { getStorybookHelpers } from '@wc-toolkit/storybook-helpers'; |
17 | 16 |
|
@@ -130,53 +129,26 @@ export const StaticBlack: Story = { |
130 | 129 | args: { |
131 | 130 | 'static-color': 'black', |
132 | 131 | }, |
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) => |
136 | 135 | template({ ...args, size: size as DividerSize }) |
137 | | - ), |
138 | | - args['static-color'] as string |
139 | | - ), |
| 136 | + )} |
| 137 | + </div> |
| 138 | + `, |
140 | 139 | tags: ['!dev'], |
141 | 140 | }; |
142 | 141 |
|
143 | 142 | export const StaticWhite: Story = { |
144 | 143 | args: { |
145 | 144 | 'static-color': 'white', |
146 | 145 | }, |
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) => |
150 | 149 | template({ ...args, size: size as DividerSize }) |
151 | | - ), |
152 | | - args['static-color'] as string |
153 | | - ), |
| 150 | + )} |
| 151 | + </div> |
| 152 | + `, |
154 | 153 | tags: ['!dev'], |
155 | 154 | }; |
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