Anvil/stories/atoms/Created.stories.ts
André Jaenisch 10cab60d63
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>
2024-07-04 08:21:34 +02:00

34 lines
720 B
TypeScript

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 = {};