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:
André Jaenisch 2024-02-12 12:32:08 +01:00
parent 41d82656b3
commit 10cab60d63
No known key found for this signature in database
GPG key ID: 5A668E771F1ED854

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