From cf0d7f613785627fe61288e3619732f2dbc3a188 Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Thu, 22 Feb 2024 12:40:19 +0100 Subject: [PATCH] Remove storybook examples --- frontend/src/stories/Button.stories.ts | 48 ------------------ frontend/src/stories/Button.svelte | 34 ------------- frontend/src/stories/Header.stories.ts | 26 ---------- frontend/src/stories/Header.svelte | 52 ------------------- frontend/src/stories/Page.stories.ts | 32 ------------ frontend/src/stories/Page.svelte | 70 -------------------------- 6 files changed, 262 deletions(-) delete mode 100644 frontend/src/stories/Button.stories.ts delete mode 100644 frontend/src/stories/Button.svelte delete mode 100644 frontend/src/stories/Header.stories.ts delete mode 100644 frontend/src/stories/Header.svelte delete mode 100644 frontend/src/stories/Page.stories.ts delete mode 100644 frontend/src/stories/Page.svelte diff --git a/frontend/src/stories/Button.stories.ts b/frontend/src/stories/Button.stories.ts deleted file mode 100644 index 119cb87f6..000000000 --- a/frontend/src/stories/Button.stories.ts +++ /dev/null @@ -1,48 +0,0 @@ -import type { Meta, StoryObj } from '@storybook/svelte'; - -import Button from './Button.svelte'; - -// More on how to set up stories at: https://storybook.js.org/docs/writing-stories -const meta = { - title: 'Example/Button', - component: Button, - tags: ['autodocs'], - argTypes: { - backgroundColor: { control: 'color' }, - size: { - control: { type: 'select' }, - options: ['small', 'medium', 'large'], - }, - }, -} satisfies Meta diff --git a/frontend/src/stories/Header.stories.ts b/frontend/src/stories/Header.stories.ts deleted file mode 100644 index a7ffe757d..000000000 --- a/frontend/src/stories/Header.stories.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { Meta, StoryObj } from '@storybook/svelte'; -import Header from './Header.svelte'; - -const meta = { - title: 'Example/Header', - component: Header, - // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs - tags: ['autodocs'], - parameters: { - // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout - layout: 'fullscreen', - }, -} satisfies Meta
; - -export default meta; -type Story = StoryObj; - -export const LoggedIn: Story = { - args: { - user: { - name: 'Jane Doe', - }, - }, -}; - -export const LoggedOut: Story = {}; diff --git a/frontend/src/stories/Header.svelte b/frontend/src/stories/Header.svelte deleted file mode 100644 index cb6f82d5e..000000000 --- a/frontend/src/stories/Header.svelte +++ /dev/null @@ -1,52 +0,0 @@ - - -
-
-
- - - - - - - -

Acme

-
-
- {#if user} - - Welcome, {user.name}! - -
-
-
diff --git a/frontend/src/stories/Page.stories.ts b/frontend/src/stories/Page.stories.ts deleted file mode 100644 index ace35ddb2..000000000 --- a/frontend/src/stories/Page.stories.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { Meta, StoryObj } from '@storybook/svelte'; -import { within, userEvent, expect } from '@storybook/test'; - -import Page from './Page.svelte'; - -const meta = { - title: 'Example/Page', - component: Page, - parameters: { - // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout - layout: 'fullscreen', - }, -} satisfies Meta; - -export default meta; -type Story = StoryObj; - -export const LoggedOut: Story = {}; - -// More on interaction testing: https://storybook.js.org/docs/writing-tests/interaction-testing -export const LoggedIn: Story = { - play: async ({ canvasElement }) => { - const canvas = within(canvasElement); - const loginButton = canvas.getByRole('button', { name: /Log in/i }); - await expect(loginButton).toBeInTheDocument(); - await userEvent.click(loginButton); - await expect(loginButton).not.toBeInTheDocument(); - - const logoutButton = canvas.getByRole('button', { name: /Log out/i }); - await expect(logoutButton).toBeInTheDocument(); - }, -}; diff --git a/frontend/src/stories/Page.svelte b/frontend/src/stories/Page.svelte deleted file mode 100644 index 94cdb07ec..000000000 --- a/frontend/src/stories/Page.svelte +++ /dev/null @@ -1,70 +0,0 @@ - - -
-
(user = { name: 'Jane Doe' })} - on:logout={() => (user = null)} - on:createAccount={() => (user = { name: 'Jane Doe' })} - /> - -
-

Pages in Storybook

-

- We recommend building UIs with a - - component-driven - - process starting with atomic components and ending with pages. -

-

- Render pages with mock data. This makes it easy to build and review page states without - needing to navigate to them in your app. Here are some handy patterns for managing page data - in Storybook: -

-
    -
  • - Use a higher-level connected component. Storybook helps you compose such data from the - "args" of child component stories -
  • -
  • - Assemble data in the page component from your services. You can mock these services out - using Storybook. -
  • -
-

- Get a guided tutorial on component-driven development at - - Storybook tutorials - - . Read more in the - docs - . -

-
- Tip - Adjust the width of the canvas with the - - - - - - Viewports addon in the toolbar -
-
-