docs: create story for Created.svelte
This will need a refactor at some point by computing the formatted value as reactive variable depending on the created_at and locale. Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
This commit is contained in:
parent
41d82656b3
commit
10cab60d63
1 changed files with 34 additions and 0 deletions
34
stories/atoms/Created.stories.ts
Normal file
34
stories/atoms/Created.stories.ts
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
import type { Meta, StoryObj } from '@storybook/svelte';
|
||||||
|
|
||||||
|
import Created from '$lib/components/atoms/Created.svelte';
|
||||||
|
|
||||||
|
const meta = {
|
||||||
|
title: 'Atoms/Created',
|
||||||
|
component: Created,
|
||||||
|
tags: ['autodocs'],
|
||||||
|
argTypes: {
|
||||||
|
created_at: {
|
||||||
|
control: 'date',
|
||||||
|
description: 'Date of creation'
|
||||||
|
},
|
||||||
|
created_at_formatted: {
|
||||||
|
control: 'text',
|
||||||
|
description: 'Localised version of created_at'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} satisfies Meta<Created>;
|
||||||
|
|
||||||
|
export default meta;
|
||||||
|
type Story = StoryObj<typeof meta>;
|
||||||
|
|
||||||
|
export const Plain: Story = {
|
||||||
|
args: {
|
||||||
|
created_at: new Date(),
|
||||||
|
created_at_formatted: (function () {
|
||||||
|
const locale = 'en-US';
|
||||||
|
return new Intl.DateTimeFormat(locale).format(new Date());
|
||||||
|
})()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const Missing: Story = {};
|
Loading…
Reference in a new issue