Skip to content

Commit faba5c8

Browse files
feat(statuslight): add sizeMap decorator
1 parent 61c6352 commit faba5c8

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

second-gen/packages/swc/components/status-light/stories/status-light.stories.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ export const Sizes: Story = {
157157
CONTAINER(
158158
StatusLight.VALID_SIZES.map(
159159
(size: StatusLightSize) => html`
160-
<swc-status-light size="${size}">${size}</swc-status-light>
160+
<swc-status-light size="${size}"
161+
>${sizeMap(size)}</swc-status-light
162+
>
161163
`
162164
)
163165
),
@@ -176,6 +178,23 @@ function capitalize(str?: string): string {
176178
return str.charAt(0).toUpperCase() + str.slice(1);
177179
}
178180

181+
/* @todo Pull this up into a utility function for more components to leverage. Are all sizes accounted for? */
182+
function sizeMap(str?: StatusLightSize): string {
183+
const sizeLabels = {
184+
labels: {
185+
xxs: 'Extra-extra-small',
186+
xs: 'Extra-small',
187+
s: 'Small',
188+
m: 'Medium',
189+
l: 'Large',
190+
xl: 'Extra-large',
191+
xxl: 'Extra-extra-large',
192+
},
193+
};
194+
195+
return str ? sizeLabels.labels[str] : '';
196+
}
197+
179198
/* @todo Pull this up into a decorator for all stories to leverage */
180199
function CONTAINER(content: TemplateResult<1>[]): TemplateResult {
181200
return html`<div

0 commit comments

Comments
 (0)