From b0366f26edb5881ee08d57215d65761041e94b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Jaenisch?= Date: Tue, 20 Feb 2024 15:08:56 +0100 Subject: [PATCH] feat: create stories for Profile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I also updated the icons to reflect all in use. Signed-off-by: André Jaenisch --- stories/icons/AlertFill16.stories.ts | 2 +- stories/icons/Info16.stories.ts | 2 +- stories/icons/NorthStar24.stories.ts | 18 ++++++++++++++ stories/icons/Repo24.stories.ts | 2 +- stories/icons/Star16.stories.ts | 18 ++++++++++++++ stories/icons/Upload16.stories.ts | 2 +- stories/pages/Profile.stories.ts | 35 ++++++++++++++++++++++++++++ stories/templates/Profile.stories.ts | 35 ++++++++++++++++++++++++++++ 8 files changed, 110 insertions(+), 4 deletions(-) create mode 100644 stories/icons/NorthStar24.stories.ts create mode 100644 stories/icons/Star16.stories.ts create mode 100644 stories/pages/Profile.stories.ts create mode 100644 stories/templates/Profile.stories.ts diff --git a/stories/icons/AlertFill16.stories.ts b/stories/icons/AlertFill16.stories.ts index a1b5c5c..1101223 100644 --- a/stories/icons/AlertFill16.stories.ts +++ b/stories/icons/AlertFill16.stories.ts @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from '@storybook/svelte'; -import AlertFill16 from 'svelte-octicons/lib/AlertFill16.svelte'; +import { AlertFill16 } from 'svelte-octicons'; const meta = { title: 'Icons/AlertFill16', diff --git a/stories/icons/Info16.stories.ts b/stories/icons/Info16.stories.ts index f10bcae..c382e39 100644 --- a/stories/icons/Info16.stories.ts +++ b/stories/icons/Info16.stories.ts @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from '@storybook/svelte'; -import Info16 from 'svelte-octicons/lib/Info16.svelte'; +import { Info16 } from 'svelte-octicons'; const meta = { title: 'Icons/Info16', diff --git a/stories/icons/NorthStar24.stories.ts b/stories/icons/NorthStar24.stories.ts new file mode 100644 index 0000000..c9eae9f --- /dev/null +++ b/stories/icons/NorthStar24.stories.ts @@ -0,0 +1,18 @@ +import type { Meta, StoryObj } from '@storybook/svelte'; +import { NorthStar24 } from 'svelte-octicons'; + +const meta = { + title: 'Icons/NorthStar24', + component: NorthStar24, + tags: ['autodocs'], + argTypes: { + fill: { + control: 'color' + } + } +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +export const Plain: Story = {}; diff --git a/stories/icons/Repo24.stories.ts b/stories/icons/Repo24.stories.ts index a3d61ea..b38f175 100644 --- a/stories/icons/Repo24.stories.ts +++ b/stories/icons/Repo24.stories.ts @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from '@storybook/svelte'; -import Repo24 from 'svelte-octicons/lib/Repo24.svelte'; +import { Repo24 } from 'svelte-octicons'; const meta = { title: 'Icons/Repo24', diff --git a/stories/icons/Star16.stories.ts b/stories/icons/Star16.stories.ts new file mode 100644 index 0000000..d894c63 --- /dev/null +++ b/stories/icons/Star16.stories.ts @@ -0,0 +1,18 @@ +import type { Meta, StoryObj } from '@storybook/svelte'; +import { Star16 } from 'svelte-octicons'; + +const meta = { + title: 'Icons/Star16', + component: Star16, + tags: ['autodocs'], + argTypes: { + fill: { + control: 'color' + } + } +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +export const Plain: Story = {}; diff --git a/stories/icons/Upload16.stories.ts b/stories/icons/Upload16.stories.ts index 67c6913..ee5edca 100644 --- a/stories/icons/Upload16.stories.ts +++ b/stories/icons/Upload16.stories.ts @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from '@storybook/svelte'; -import Upload16 from 'svelte-octicons/lib/Upload16.svelte'; +import { Upload16 } from 'svelte-octicons'; const meta = { title: 'Icons/Upload16', diff --git a/stories/pages/Profile.stories.ts b/stories/pages/Profile.stories.ts new file mode 100644 index 0000000..58f4d75 --- /dev/null +++ b/stories/pages/Profile.stories.ts @@ -0,0 +1,35 @@ +import type { Meta, StoryObj } from '@storybook/svelte'; + +import Profile from '$lib/components/pages/Profile.svelte'; + +const meta = { + title: 'Pages/Profile', + component: Profile, + tags: ['autodocs'], + argTypes: { + data: { controls: 'object' } + } +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +export const Plain: Story = { + args: { + data: { + user: { + avatar: '', + created_at: new Date(), + created_at_formatted: (function () { + const locale = 'en-US'; + return new Intl.DateTimeFormat(locale).format(new Date()); + })(), + created_with: 'Anvil', + display_name: 'Jane Doe', + instance: 'domain.example', + pronoun: 'she/her', + username: 'jane_doe' + } + } + } +}; diff --git a/stories/templates/Profile.stories.ts b/stories/templates/Profile.stories.ts new file mode 100644 index 0000000..682828c --- /dev/null +++ b/stories/templates/Profile.stories.ts @@ -0,0 +1,35 @@ +import type { Meta, StoryObj } from '@storybook/svelte'; + +import Profile from '$lib/components/templates/Profile.svelte'; + +const meta = { + title: 'Templates/Profile', + component: Profile, + tags: ['autodocs'], + argTypes: { + data: { controls: 'object' } + } +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +export const Plain: Story = { + args: { + data: { + user: { + avatar: '', + created_at: new Date(), + created_at_formatted: (function () { + const locale = 'en-US'; + return new Intl.DateTimeFormat(locale).format(new Date()); + })(), + created_with: 'Anvil', + display_name: 'Jane Doe', + instance: 'domain.example', + pronoun: 'she/her', + username: 'jane_doe' + } + } + } +};