From 6a116f4cbbc02bdccf4d55ec9301b83ac4e0b142 Mon Sep 17 00:00:00 2001 From: JesmoDev <26099018+JesmoDev@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:40:35 +0200 Subject: [PATCH] badge stories --- packages/uui-badge/lib/uui-badge.stories.ts | 72 +++++++++++++++++++-- 1 file changed, 68 insertions(+), 4 deletions(-) diff --git a/packages/uui-badge/lib/uui-badge.stories.ts b/packages/uui-badge/lib/uui-badge.stories.ts index 67aa99e9f..309a997ab 100644 --- a/packages/uui-badge/lib/uui-badge.stories.ts +++ b/packages/uui-badge/lib/uui-badge.stories.ts @@ -6,9 +6,29 @@ import { spread } from '../../../storyhelpers/spread-directive'; const meta: Meta = { component: 'uui-badge', title: 'Displays/Badge', + args: { + slot: '2', + }, + argTypes: { + look: { + options: ['default', 'primary', 'secondary', 'outline', 'placeholder'], + }, + color: { + options: ['default', 'positive', 'warning', 'danger'], + }, + }, render: args => { - return html`2`; + return html`${args.slot}`; }, +}; + +export default meta; +type Story = StoryObj; + +// We can't have a component decorator because the looks and colors story needs to be rendered differently. +// Instead we inherit the default story. + +export const Default: Story = { decorators: [ story => html`
{ + return html` + + `; + }, +}; + +export const LooksAndColors: Story = { + render: () => { + const looks = ['default', 'primary', 'secondary', 'outline', 'placeholder']; + const colors = ['default', 'positive', 'warning', 'danger']; + + const uppercaseFirstLetter = (str: string) => + str.charAt(0).toUpperCase() + str.slice(1); -export const Default: Story = {}; + return html` + ${colors.map( + color => html` +
${uppercaseFirstLetter(color)}
+
+ ${looks.map( + look => html` +
+ ${uppercaseFirstLetter(look)} +
+ `, + )} +
+ `, + )} + `; + }, +};