diff --git a/.storybook/preview.ts b/.storybook/preview.ts index 66cbf53fe..ecbeb66cd 100644 --- a/.storybook/preview.ts +++ b/.storybook/preview.ts @@ -1,6 +1,7 @@ import { setup } from '@storybook/vue3' import { createPinia } from 'pinia' +import { setPageContext } from '#context/usePageContext' import i18n from '#plugins/i18n' import CreateVuetify from '#plugins/vuetify' @@ -10,11 +11,12 @@ import type { Preview } from '@storybook/vue3' setup((app) => { // Registers your app's plugins into Storybook - // app.use(vuetify); const pinia = createPinia() app.use(pinia) app.use(i18n) app.use(CreateVuetify(i18n)) + + setPageContext(app, { urlPathname: '' }) }) export const decorators = [withVuetifyTheme] diff --git a/src/components/menu/LogoAvatar.stories.ts b/src/components/menu/LogoAvatar.stories.ts new file mode 100644 index 000000000..8d21f75b1 --- /dev/null +++ b/src/components/menu/LogoAvatar.stories.ts @@ -0,0 +1,20 @@ +import { SBComp } from '#types/SBComp' + +import LogoAvatar from './LogoAvatar.vue' + +import type { Meta, StoryObj } from '@storybook/vue3' + +const meta = { + title: 'Menu/LogoAvatar', + component: LogoAvatar as SBComp, + tags: ['autodocs'], + argTypes: {}, + args: {}, +} satisfies Meta + +export default meta +type Story = StoryObj + +export const Example: Story = { + args: {}, +} diff --git a/src/components/menu/TopMenu.stories.ts b/src/components/menu/TopMenu.stories.ts new file mode 100644 index 000000000..9594b3282 --- /dev/null +++ b/src/components/menu/TopMenu.stories.ts @@ -0,0 +1,20 @@ +import { SBComp } from '#types/SBComp' + +import TopMenu from './TopMenu.vue' + +import type { Meta, StoryObj } from '@storybook/vue3' + +const meta = { + title: 'Menu/TopMenu', + component: TopMenu as SBComp, + tags: ['autodocs'], + argTypes: {}, + args: {}, +} satisfies Meta + +export default meta +type Story = StoryObj + +export const Example: Story = { + args: {}, +} diff --git a/src/layouts/Page.stories.ts b/src/layouts/Page.stories.ts new file mode 100644 index 000000000..c4c521cf1 --- /dev/null +++ b/src/layouts/Page.stories.ts @@ -0,0 +1,20 @@ +import { SBComp } from '#types/SBComp' + +import Layout from './DefaultLayout.vue' + +import type { Meta, StoryObj } from '@storybook/vue3' + +const meta = { + title: 'Layouts/Default', + component: Layout as SBComp, + tags: ['autodocs'], + argTypes: {}, + args: {}, +} satisfies Meta + +export default meta +type Story = StoryObj + +export const Example: Story = { + args: {}, +} diff --git a/src/pages/_error/Page.stories.ts b/src/pages/_error/Page.stories.ts new file mode 100644 index 000000000..ceba74dc5 --- /dev/null +++ b/src/pages/_error/Page.stories.ts @@ -0,0 +1,24 @@ +import { SBComp } from '#types/SBComp' + +import Page from './+Page.vue' + +import type { Meta, StoryObj } from '@storybook/vue3' + +const meta = { + title: 'Pages/Error', + component: Page as SBComp, + tags: ['autodocs'], + argTypes: {}, + args: {}, +} satisfies Meta + +export default meta +type Story = StoryObj + +export const Error500: Story = { + args: {}, +} + +export const Error404: Story = { + args: { is404: true }, +} diff --git a/src/pages/about/Page.stories.ts b/src/pages/about/Page.stories.ts new file mode 100644 index 000000000..34f8b4813 --- /dev/null +++ b/src/pages/about/Page.stories.ts @@ -0,0 +1,20 @@ +import { SBComp } from '#types/SBComp' + +import Page from './+Page.vue' + +import type { Meta, StoryObj } from '@storybook/vue3' + +const meta = { + title: 'Pages/About', + component: Page as SBComp, + tags: ['autodocs'], + argTypes: {}, + args: {}, +} satisfies Meta + +export default meta +type Story = StoryObj + +export const Example: Story = { + args: {}, +} diff --git a/src/pages/app/Page.stories.ts b/src/pages/app/Page.stories.ts new file mode 100644 index 000000000..e24af32c1 --- /dev/null +++ b/src/pages/app/Page.stories.ts @@ -0,0 +1,32 @@ +import { SBComp } from '#types/SBComp' + +import Page from './+Page.vue' + +import type { Meta, StoryObj } from '@storybook/vue3' + +const meta = { + title: 'Pages/App', + component: Page as SBComp, + tags: ['autodocs'], + argTypes: {}, + args: {}, +} satisfies Meta + +export default meta +type Story = StoryObj + +export const AppValue: Story = { + args: {}, +} + +export const AppInc: Story = { + args: { + page: 'inc', + }, +} + +export const AppReset: Story = { + args: { + page: 'reset', + }, +} diff --git a/src/pages/index/Page.stories.ts b/src/pages/index/Page.stories.ts new file mode 100644 index 000000000..025335d8e --- /dev/null +++ b/src/pages/index/Page.stories.ts @@ -0,0 +1,20 @@ +import { SBComp } from '#types/SBComp' + +import Page from './+Page.vue' + +import type { Meta, StoryObj } from '@storybook/vue3' + +const meta = { + title: 'Pages/Index', + component: Page as SBComp, + tags: ['autodocs'], + argTypes: {}, + args: {}, +} satisfies Meta + +export default meta +type Story = StoryObj + +export const Example: Story = { + args: {}, +} diff --git a/src/stories/Configure.mdx b/src/stories/Configure.mdx deleted file mode 100644 index 91bda6fe9..000000000 --- a/src/stories/Configure.mdx +++ /dev/null @@ -1,364 +0,0 @@ -import { Meta } from "@storybook/blocks"; - -import Github from "./assets/github.svg"; -import Discord from "./assets/discord.svg"; -import Youtube from "./assets/youtube.svg"; -import Tutorials from "./assets/tutorials.svg"; -import Styling from "./assets/styling.png"; -import Context from "./assets/context.png"; -import Assets from "./assets/assets.png"; -import Docs from "./assets/docs.png"; -import Share from "./assets/share.png"; -import FigmaPlugin from "./assets/figma-plugin.png"; -import Testing from "./assets/testing.png"; -import Accessibility from "./assets/accessibility.png"; -import Theming from "./assets/theming.png"; -import AddonLibrary from "./assets/addon-library.png"; - -export const RightArrow = () => - - - - - -
-
- # Configure your project - - Because Storybook works separately from your app, you'll need to configure it for your specific stack and setup. Below, explore guides for configuring Storybook with popular frameworks and tools. If you get stuck, learn how you can ask for help from our community. -
-
-
- A wall of logos representing different styling technologies -

Add styling and CSS

-

Like with web applications, there are many ways to include CSS within Storybook. Learn more about setting up styling within Storybook.

- Learn more -
-
- An abstraction representing the composition of data for a component -

Provide context and mocking

-

Often when a story doesn't render, it's because your component is expecting a specific environment or context (like a theme provider) to be available.

- Learn more -
-
- A representation of typography and image assets -
-

Load assets and resources

-

To link static files (like fonts) to your projects and stories, use the - `staticDirs` configuration option to specify folders to load when - starting Storybook.

- Learn more -
-
-
-
-
-
- # Do more with Storybook - - Now that you know the basics, let's explore other parts of Storybook that will improve your experience. This list is just to get you started. You can customise Storybook in many ways to fit your needs. -
- -
-
-
- A screenshot showing the autodocs tag being set, pointing a docs page being generated -

Autodocs

-

Auto-generate living, - interactive reference documentation from your components and stories.

- Learn more -
-
- A browser window showing a Storybook being published to a chromatic.com URL -

Publish to Chromatic

-

Publish your Storybook to review and collaborate with your entire team.

- Learn more -
-
- Windows showing the Storybook plugin in Figma -

Figma Plugin

-

Embed your stories into Figma to cross-reference the design and live - implementation in one place.

- Learn more -
-
- Screenshot of tests passing and failing -

Testing

-

Use stories to test a component in all its variations, no matter how - complex.

- Learn more -
-
- Screenshot of accessibility tests passing and failing -

Accessibility

-

Automatically test your components for a11y issues as you develop.

- Learn more -
-
- Screenshot of Storybook in light and dark mode -

Theming

-

Theme Storybook's UI to personalize it to your project.

- Learn more -
-
-
-
-
-
-

Addons

-

Integrate your tools with Storybook to connect workflows.

- Discover all addons -
-
- Integrate your tools with Storybook to connect workflows. -
-
- -
-
- Github logo - Join our contributors building the future of UI development. - - Star on GitHub -
-
- Discord logo -
- Get support and chat with frontend developers. - - Join Discord server -
-
-
- Youtube logo -
- Watch tutorials, feature previews and interviews. - - Watch on YouTube -
-
-
- A book -

Follow guided walkthroughs on for key workflows.

- - Discover tutorials -
-
- - diff --git a/src/stories/ExampleButton.stories.ts b/src/stories/ExampleButton.stories.ts deleted file mode 100644 index 527a6eaf6..000000000 --- a/src/stories/ExampleButton.stories.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { SBComp } from '#types/SBComp' - -import ExampleButton from './ExampleButton.vue' - -import type { Meta, StoryObj } from '@storybook/vue3' - -// More on how to set up stories at: https://storybook.js.org/docs/vue/writing-stories/introduction -const meta = { - title: 'Example/Button', - component: ExampleButton as SBComp, - // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/vue/writing-docs/autodocs - tags: ['autodocs'], - argTypes: { - size: { control: 'select', options: ['small', 'medium', 'large'] }, - backgroundColor: { control: 'color' }, - onClick: { action: 'clicked' }, - }, - args: { primary: false }, // default value -} satisfies Meta - -export default meta -type Story = StoryObj -/* - *👇 Render functions are a framework specific feature to allow you control on how the component renders. - * See https://storybook.js.org/docs/vue/api/csf - * to learn how to use render functions. - */ -export const Primary: Story = { - args: { - primary: true, - label: 'Button', - }, -} - -export const Secondary: Story = { - args: { - primary: false, - label: 'Button', - }, -} - -export const Large: Story = { - args: { - label: 'Button', - size: 'large', - }, -} - -export const Small: Story = { - args: { - label: 'Button', - size: 'small', - }, -} diff --git a/src/stories/ExampleButton.vue b/src/stories/ExampleButton.vue deleted file mode 100644 index ed85df452..000000000 --- a/src/stories/ExampleButton.vue +++ /dev/null @@ -1,50 +0,0 @@ - - - diff --git a/src/stories/ExampleHeader.stories.ts b/src/stories/ExampleHeader.stories.ts deleted file mode 100644 index 3caaf3a29..000000000 --- a/src/stories/ExampleHeader.stories.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { SBComp } from '#types/SBComp' - -import ExampleHeader from './ExampleHeader.vue' - -import type { Meta, StoryObj } from '@storybook/vue3' - -const meta = { - /* 👇 The title prop is optional. - * See https://storybook.js.org/docs/vue/configure/overview#configure-story-loading - * to learn how to generate automatic titles - */ - title: 'Example/Header', - component: ExampleHeader as SBComp, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - render: (args: any) => ({ - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - components: { ExampleHeader }, - setup() { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - return { args } - }, - template: '', - }), - parameters: { - // More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout - layout: 'fullscreen', - }, - // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/vue/writing-docs/autodocs - tags: ['autodocs'], -} satisfies Meta - -export default meta -type Story = StoryObj - -export const LoggedIn: Story = { - args: { - user: { - name: 'Jane Doe', - }, - }, -} - -export const LoggedOut: Story = { - args: { - user: null, - }, -} diff --git a/src/stories/ExampleHeader.vue b/src/stories/ExampleHeader.vue deleted file mode 100644 index a3b2724b6..000000000 --- a/src/stories/ExampleHeader.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - - diff --git a/src/stories/ExamplePage.stories.ts b/src/stories/ExamplePage.stories.ts deleted file mode 100644 index 0fa903ef8..000000000 --- a/src/stories/ExamplePage.stories.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { within, userEvent } from '@storybook/testing-library' - -import { SBComp } from '#types/SBComp' - -import ExamplePage from './ExamplePage.vue' - -import type { Meta, StoryObj } from '@storybook/vue3' - -const meta = { - title: 'Example/Page', - component: ExamplePage as SBComp, - render: () => ({ - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - components: { ExamplePage }, - template: '', - }), - parameters: { - // More on how to position stories at: https://storybook.js.org/docs/vue/configure/story-layout - layout: 'fullscreen', - }, - // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/vue/writing-docs/autodocs - tags: ['autodocs'], -} satisfies Meta - -export default meta -type Story = StoryObj - -// More on interaction testing: https://storybook.js.org/docs/vue/writing-tests/interaction-testing -export const LoggedIn: Story = { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - play: async ({ canvasElement }: any) => { - const canvas = within(canvasElement as HTMLElement) - const loginButton = canvas.getByRole('button', { - name: /Log in/i, - }) - await userEvent.click(loginButton) - }, -} - -export const LoggedOut: Story = {} diff --git a/src/stories/ExamplePage.vue b/src/stories/ExamplePage.vue deleted file mode 100644 index fece18e34..000000000 --- a/src/stories/ExamplePage.vue +++ /dev/null @@ -1,80 +0,0 @@ - - - - diff --git a/src/stories/assets/accessibility.png b/src/stories/assets/accessibility.png deleted file mode 100644 index 6ffe6feab..000000000 Binary files a/src/stories/assets/accessibility.png and /dev/null differ diff --git a/src/stories/assets/accessibility.svg b/src/stories/assets/accessibility.svg deleted file mode 100644 index a3288830e..000000000 --- a/src/stories/assets/accessibility.svg +++ /dev/null @@ -1,5 +0,0 @@ - - Accessibility - - - \ No newline at end of file diff --git a/src/stories/assets/addon-library.png b/src/stories/assets/addon-library.png deleted file mode 100644 index 95deb38a8..000000000 Binary files a/src/stories/assets/addon-library.png and /dev/null differ diff --git a/src/stories/assets/assets.png b/src/stories/assets/assets.png deleted file mode 100644 index cfba6817a..000000000 Binary files a/src/stories/assets/assets.png and /dev/null differ diff --git a/src/stories/assets/context.png b/src/stories/assets/context.png deleted file mode 100644 index e5cd249a2..000000000 Binary files a/src/stories/assets/context.png and /dev/null differ diff --git a/src/stories/assets/discord.svg b/src/stories/assets/discord.svg deleted file mode 100644 index 1204df998..000000000 --- a/src/stories/assets/discord.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/src/stories/assets/docs.png b/src/stories/assets/docs.png deleted file mode 100644 index a749629df..000000000 Binary files a/src/stories/assets/docs.png and /dev/null differ diff --git a/src/stories/assets/figma-plugin.png b/src/stories/assets/figma-plugin.png deleted file mode 100644 index 8f79b08cd..000000000 Binary files a/src/stories/assets/figma-plugin.png and /dev/null differ diff --git a/src/stories/assets/github.svg b/src/stories/assets/github.svg deleted file mode 100644 index 158e0268a..000000000 --- a/src/stories/assets/github.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/stories/assets/share.png b/src/stories/assets/share.png deleted file mode 100644 index 8097a3707..000000000 Binary files a/src/stories/assets/share.png and /dev/null differ diff --git a/src/stories/assets/styling.png b/src/stories/assets/styling.png deleted file mode 100644 index d341e8263..000000000 Binary files a/src/stories/assets/styling.png and /dev/null differ diff --git a/src/stories/assets/testing.png b/src/stories/assets/testing.png deleted file mode 100644 index d4ac39a0c..000000000 Binary files a/src/stories/assets/testing.png and /dev/null differ diff --git a/src/stories/assets/theming.png b/src/stories/assets/theming.png deleted file mode 100644 index 1535eb9b8..000000000 Binary files a/src/stories/assets/theming.png and /dev/null differ diff --git a/src/stories/assets/tutorials.svg b/src/stories/assets/tutorials.svg deleted file mode 100644 index 4b2fc7c44..000000000 --- a/src/stories/assets/tutorials.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/src/stories/assets/youtube.svg b/src/stories/assets/youtube.svg deleted file mode 100644 index 33a3a61f6..000000000 --- a/src/stories/assets/youtube.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/stories/button.css b/src/stories/button.css deleted file mode 100644 index 1d36ef0c9..000000000 --- a/src/stories/button.css +++ /dev/null @@ -1,40 +0,0 @@ -.storybook-button { - display: inline-block; - font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; - font-weight: 700; - line-height: 1; - cursor: pointer; - border: 0; - border-radius: 3em; -} - -/* stylelint-disable-next-line selector-class-pattern */ -.storybook-button--primary { - color: white; - background-color: #1ea7fd; -} - -/* stylelint-disable-next-line selector-class-pattern */ -.storybook-button--secondary { - color: #333; - background-color: transparent; - box-shadow: rgb(0 0 0 / 15%) 0 0 0 1px inset; -} - -/* stylelint-disable-next-line selector-class-pattern */ -.storybook-button--small { - padding: 10px 16px; - font-size: 12px; -} - -/* stylelint-disable-next-line selector-class-pattern */ -.storybook-button--medium { - padding: 11px 20px; - font-size: 14px; -} - -/* stylelint-disable-next-line selector-class-pattern */ -.storybook-button--large { - padding: 12px 24px; - font-size: 16px; -} diff --git a/src/stories/header.css b/src/stories/header.css deleted file mode 100644 index 71fd9f8b4..000000000 --- a/src/stories/header.css +++ /dev/null @@ -1,32 +0,0 @@ -.storybook-header { - display: flex; - align-items: center; - justify-content: space-between; - padding: 15px 20px; - font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; - border-bottom: 1px solid rgb(0 0 0 / 10%); -} - -.storybook-header svg { - display: inline-block; - vertical-align: top; -} - -.storybook-header h1 { - display: inline-block; - margin: 6px 0 6px 10px; - font-size: 20px; - font-weight: 700; - line-height: 1; - vertical-align: top; -} - -.storybook-header button + button { - margin-left: 10px; -} - -.storybook-header .welcome { - margin-right: 10px; - font-size: 14px; - color: #333; -} diff --git a/src/stories/page.css b/src/stories/page.css deleted file mode 100644 index bc84a9d52..000000000 --- a/src/stories/page.css +++ /dev/null @@ -1,69 +0,0 @@ -.storybook-page { - max-width: 600px; - padding: 48px 20px; - margin: 0 auto; - font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; - font-size: 14px; - line-height: 24px; - color: #333; -} - -.storybook-page h2 { - display: inline-block; - margin: 0 0 4px; - font-size: 32px; - font-weight: 700; - line-height: 1; - vertical-align: top; -} - -.storybook-page p { - margin: 1em 0; -} - -.storybook-page a { - color: #1ea7fd; - text-decoration: none; -} - -.storybook-page ul { - padding-left: 30px; - margin: 1em 0; -} - -.storybook-page li { - margin-bottom: 8px; -} - -.storybook-page .tip { - display: inline-block; - padding: 4px 12px; - margin-right: 10px; - font-size: 11px; - font-weight: 700; - line-height: 12px; - color: #66bf3c; - vertical-align: top; - background: #e7fdd8; - border-radius: 1em; -} - -.storybook-page .tip-wrapper { - margin-top: 40px; - margin-bottom: 40px; - font-size: 13px; - line-height: 20px; -} - -.storybook-page .tip-wrapper svg { - display: inline-block; - width: 12px; - height: 12px; - margin-top: 3px; - margin-right: 4px; - vertical-align: top; -} - -.storybook-page .tip-wrapper svg path { - fill: #1ea7fd; -}