diff --git a/src/dispatch/static/dispatch/.storybook/StoryWrapper.vue b/src/dispatch/static/dispatch/.storybook/StoryWrapper.vue new file mode 100644 index 000000000000..a6628d10b6ae --- /dev/null +++ b/src/dispatch/static/dispatch/.storybook/StoryWrapper.vue @@ -0,0 +1,9 @@ + + + diff --git a/src/dispatch/static/dispatch/.storybook/main.js b/src/dispatch/static/dispatch/.storybook/main.js new file mode 100644 index 000000000000..dc21275b8f45 --- /dev/null +++ b/src/dispatch/static/dispatch/.storybook/main.js @@ -0,0 +1,18 @@ +/** @type { import('@storybook/vue3-vite').StorybookConfig } */ +const config = { + stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], + addons: [ + "@storybook/addon-links", + "@storybook/addon-essentials", + "@storybook/addon-interactions", + "storybook-addon-vuetify3", + ], + framework: { + name: "@storybook/vue3-vite", + options: {}, + }, + docs: { + autodocs: "tag", + }, +} +export default config diff --git a/src/dispatch/static/dispatch/.storybook/preview.js b/src/dispatch/static/dispatch/.storybook/preview.js new file mode 100644 index 000000000000..fc71f526f15a --- /dev/null +++ b/src/dispatch/static/dispatch/.storybook/preview.js @@ -0,0 +1,3 @@ +import { withVuetify } from "storybook-addon-vuetify3/dist/decorators" + +export const decorators = [withVuetify] diff --git a/src/dispatch/static/dispatch/.storybook/withVuetifyTheme.decorator.js b/src/dispatch/static/dispatch/.storybook/withVuetifyTheme.decorator.js new file mode 100644 index 000000000000..bb5560bdf88e --- /dev/null +++ b/src/dispatch/static/dispatch/.storybook/withVuetifyTheme.decorator.js @@ -0,0 +1,18 @@ +// .storybook/withVeutifyTheme.decorator.js +import { h } from "vue" +import StoryWrapper from "./StoryWrapper.vue" + +export const withVuetifyTheme = (storyFn, context) => { + const story = storyFn() + + return () => { + return h( + StoryWrapper, + {}, // Props for StoryWrapper + { + // Puts your story into StoryWrapper's "story" slot with your story args + story: () => h(story, { ...context.args }), + } + ) + } +} diff --git a/src/dispatch/static/dispatch/src/stories/Button.stories.js b/src/dispatch/static/dispatch/src/stories/Button.stories.js new file mode 100644 index 000000000000..9f43ad58ce83 --- /dev/null +++ b/src/dispatch/static/dispatch/src/stories/Button.stories.js @@ -0,0 +1,48 @@ +import MyButton from './Button.vue'; + +// More on how to set up stories at: https://storybook.js.org/docs/vue/writing-stories/introduction +export default { + title: 'Example/Button', + component: MyButton, + tags: ['autodocs'], + argTypes: { + backgroundColor: { + control: 'color', + }, + onClick: {}, + size: { + control: { + type: 'select', + }, + options: ['small', 'medium', 'large'], + }, + }, +}; + +// More on writing stories with args: https://storybook.js.org/docs/vue/writing-stories/args +export const Primary = { + args: { + primary: true, + label: 'Button', + }, +}; + +export const Secondary = { + args: { + label: 'Button', + }, +}; + +export const Large = { + args: { + size: 'large', + label: 'Button', + }, +}; + +export const Small = { + args: { + size: 'small', + label: 'Button', + }, +}; diff --git a/src/dispatch/static/dispatch/src/stories/Button.vue b/src/dispatch/static/dispatch/src/stories/Button.vue new file mode 100644 index 000000000000..0fcd60e8ba91 --- /dev/null +++ b/src/dispatch/static/dispatch/src/stories/Button.vue @@ -0,0 +1,52 @@ + + + diff --git a/src/dispatch/static/dispatch/src/stories/Configure.mdx b/src/dispatch/static/dispatch/src/stories/Configure.mdx new file mode 100644 index 000000000000..91bda6fe9adc --- /dev/null +++ b/src/dispatch/static/dispatch/src/stories/Configure.mdx @@ -0,0 +1,364 @@ +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/dispatch/static/dispatch/src/stories/Header.stories.js b/src/dispatch/static/dispatch/src/stories/Header.stories.js new file mode 100644 index 000000000000..61e6906ea988 --- /dev/null +++ b/src/dispatch/static/dispatch/src/stories/Header.stories.js @@ -0,0 +1,41 @@ +import MyHeader from './Header.vue'; + +export default { + title: 'Example/Header', + component: MyHeader, + // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/vue/writing-docs/autodocs + tags: ['autodocs'], + render: (args) => ({ + // Components used in your story `template` are defined in the `components` object + components: { + MyHeader, + }, + // The story's `args` need to be mapped into the template through the `setup()` method + setup() { + // Story args can be spread into the returned object + return { + ...args, + }; + }, + // Then, the spread values can be accessed directly in the template + template: '', + }), + parameters: { + // More on how to position stories at: https://storybook.js.org/docs/vue/configure/story-layout + layout: 'fullscreen', + }, +}; + +export const LoggedIn = { + args: { + user: { + name: 'Jane Doe', + }, + }, +}; + +export const LoggedOut = { + args: { + user: null, + }, +}; diff --git a/src/dispatch/static/dispatch/src/stories/Header.vue b/src/dispatch/static/dispatch/src/stories/Header.vue new file mode 100644 index 000000000000..16d7740d96c4 --- /dev/null +++ b/src/dispatch/static/dispatch/src/stories/Header.vue @@ -0,0 +1,59 @@ + + + diff --git a/src/dispatch/static/dispatch/src/stories/Page.stories.js b/src/dispatch/static/dispatch/src/stories/Page.stories.js new file mode 100644 index 000000000000..f11ff44e5bdf --- /dev/null +++ b/src/dispatch/static/dispatch/src/stories/Page.stories.js @@ -0,0 +1,30 @@ +import { within, userEvent } from '@storybook/testing-library'; +import MyPage from './Page.vue'; + +export default { + title: 'Example/Page', + component: MyPage, + parameters: { + // More on how to position stories at: https://storybook.js.org/docs/vue/configure/story-layout + layout: 'fullscreen', + }, +}; + +export const LoggedOut = {}; + +// More on interaction testing: https://storybook.js.org/docs/vue/writing-tests/interaction-testing +export const LoggedIn = { + render: () => ({ + components: { + MyPage, + }, + template: '', + }), + play: async ({ canvasElement }) => { + const canvas = within(canvasElement); + const loginButton = await canvas.getByRole('button', { + name: /Log in/i, + }); + await userEvent.click(loginButton); + }, +}; diff --git a/src/dispatch/static/dispatch/src/stories/Page.vue b/src/dispatch/static/dispatch/src/stories/Page.vue new file mode 100644 index 000000000000..245401b72c4d --- /dev/null +++ b/src/dispatch/static/dispatch/src/stories/Page.vue @@ -0,0 +1,83 @@ + + + diff --git a/src/dispatch/static/dispatch/src/stories/assets/accessibility.png b/src/dispatch/static/dispatch/src/stories/assets/accessibility.png new file mode 100644 index 000000000000..6ffe6feabdc1 Binary files /dev/null and b/src/dispatch/static/dispatch/src/stories/assets/accessibility.png differ diff --git a/src/dispatch/static/dispatch/src/stories/assets/accessibility.svg b/src/dispatch/static/dispatch/src/stories/assets/accessibility.svg new file mode 100644 index 000000000000..a3288830e348 --- /dev/null +++ b/src/dispatch/static/dispatch/src/stories/assets/accessibility.svg @@ -0,0 +1,5 @@ + + Accessibility + + + \ No newline at end of file diff --git a/src/dispatch/static/dispatch/src/stories/assets/addon-library.png b/src/dispatch/static/dispatch/src/stories/assets/addon-library.png new file mode 100644 index 000000000000..95deb38a88de Binary files /dev/null and b/src/dispatch/static/dispatch/src/stories/assets/addon-library.png differ diff --git a/src/dispatch/static/dispatch/src/stories/assets/assets.png b/src/dispatch/static/dispatch/src/stories/assets/assets.png new file mode 100644 index 000000000000..cfba6817aeb6 Binary files /dev/null and b/src/dispatch/static/dispatch/src/stories/assets/assets.png differ diff --git a/src/dispatch/static/dispatch/src/stories/assets/context.png b/src/dispatch/static/dispatch/src/stories/assets/context.png new file mode 100644 index 000000000000..e5cd249a2d3a Binary files /dev/null and b/src/dispatch/static/dispatch/src/stories/assets/context.png differ diff --git a/src/dispatch/static/dispatch/src/stories/assets/discord.svg b/src/dispatch/static/dispatch/src/stories/assets/discord.svg new file mode 100644 index 000000000000..1204df998d0e --- /dev/null +++ b/src/dispatch/static/dispatch/src/stories/assets/discord.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/dispatch/static/dispatch/src/stories/assets/docs.png b/src/dispatch/static/dispatch/src/stories/assets/docs.png new file mode 100644 index 000000000000..a749629df9ef Binary files /dev/null and b/src/dispatch/static/dispatch/src/stories/assets/docs.png differ diff --git a/src/dispatch/static/dispatch/src/stories/assets/figma-plugin.png b/src/dispatch/static/dispatch/src/stories/assets/figma-plugin.png new file mode 100644 index 000000000000..8f79b08cdf28 Binary files /dev/null and b/src/dispatch/static/dispatch/src/stories/assets/figma-plugin.png differ diff --git a/src/dispatch/static/dispatch/src/stories/assets/github.svg b/src/dispatch/static/dispatch/src/stories/assets/github.svg new file mode 100644 index 000000000000..158e0268a343 --- /dev/null +++ b/src/dispatch/static/dispatch/src/stories/assets/github.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/dispatch/static/dispatch/src/stories/assets/share.png b/src/dispatch/static/dispatch/src/stories/assets/share.png new file mode 100644 index 000000000000..8097a370777a Binary files /dev/null and b/src/dispatch/static/dispatch/src/stories/assets/share.png differ diff --git a/src/dispatch/static/dispatch/src/stories/assets/styling.png b/src/dispatch/static/dispatch/src/stories/assets/styling.png new file mode 100644 index 000000000000..d341e8263e40 Binary files /dev/null and b/src/dispatch/static/dispatch/src/stories/assets/styling.png differ diff --git a/src/dispatch/static/dispatch/src/stories/assets/testing.png b/src/dispatch/static/dispatch/src/stories/assets/testing.png new file mode 100644 index 000000000000..d4ac39a0ced9 Binary files /dev/null and b/src/dispatch/static/dispatch/src/stories/assets/testing.png differ diff --git a/src/dispatch/static/dispatch/src/stories/assets/theming.png b/src/dispatch/static/dispatch/src/stories/assets/theming.png new file mode 100644 index 000000000000..1535eb9b8192 Binary files /dev/null and b/src/dispatch/static/dispatch/src/stories/assets/theming.png differ diff --git a/src/dispatch/static/dispatch/src/stories/assets/tutorials.svg b/src/dispatch/static/dispatch/src/stories/assets/tutorials.svg new file mode 100644 index 000000000000..4b2fc7c44b80 --- /dev/null +++ b/src/dispatch/static/dispatch/src/stories/assets/tutorials.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/dispatch/static/dispatch/src/stories/assets/youtube.svg b/src/dispatch/static/dispatch/src/stories/assets/youtube.svg new file mode 100644 index 000000000000..33a3a61f611e --- /dev/null +++ b/src/dispatch/static/dispatch/src/stories/assets/youtube.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/dispatch/static/dispatch/src/stories/button.css b/src/dispatch/static/dispatch/src/stories/button.css new file mode 100644 index 000000000000..dc91dc76370b --- /dev/null +++ b/src/dispatch/static/dispatch/src/stories/button.css @@ -0,0 +1,30 @@ +.storybook-button { + font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-weight: 700; + border: 0; + border-radius: 3em; + cursor: pointer; + display: inline-block; + line-height: 1; +} +.storybook-button--primary { + color: white; + background-color: #1ea7fd; +} +.storybook-button--secondary { + color: #333; + background-color: transparent; + box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset; +} +.storybook-button--small { + font-size: 12px; + padding: 10px 16px; +} +.storybook-button--medium { + font-size: 14px; + padding: 11px 20px; +} +.storybook-button--large { + font-size: 16px; + padding: 12px 24px; +} diff --git a/src/dispatch/static/dispatch/src/stories/header.css b/src/dispatch/static/dispatch/src/stories/header.css new file mode 100644 index 000000000000..d9a70528a3a1 --- /dev/null +++ b/src/dispatch/static/dispatch/src/stories/header.css @@ -0,0 +1,32 @@ +.storybook-header { + font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; + border-bottom: 1px solid rgba(0, 0, 0, 0.1); + padding: 15px 20px; + display: flex; + align-items: center; + justify-content: space-between; +} + +.storybook-header svg { + display: inline-block; + vertical-align: top; +} + +.storybook-header h1 { + font-weight: 700; + font-size: 20px; + line-height: 1; + margin: 6px 0 6px 10px; + display: inline-block; + vertical-align: top; +} + +.storybook-header button + button { + margin-left: 10px; +} + +.storybook-header .welcome { + color: #333; + font-size: 14px; + margin-right: 10px; +} diff --git a/src/dispatch/static/dispatch/src/stories/page.css b/src/dispatch/static/dispatch/src/stories/page.css new file mode 100644 index 000000000000..098dad118500 --- /dev/null +++ b/src/dispatch/static/dispatch/src/stories/page.css @@ -0,0 +1,69 @@ +.storybook-page { + font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-size: 14px; + line-height: 24px; + padding: 48px 20px; + margin: 0 auto; + max-width: 600px; + color: #333; +} + +.storybook-page h2 { + font-weight: 700; + font-size: 32px; + line-height: 1; + margin: 0 0 4px; + display: inline-block; + vertical-align: top; +} + +.storybook-page p { + margin: 1em 0; +} + +.storybook-page a { + text-decoration: none; + color: #1ea7fd; +} + +.storybook-page ul { + padding-left: 30px; + margin: 1em 0; +} + +.storybook-page li { + margin-bottom: 8px; +} + +.storybook-page .tip { + display: inline-block; + border-radius: 1em; + font-size: 11px; + line-height: 12px; + font-weight: 700; + background: #e7fdd8; + color: #66bf3c; + padding: 4px 12px; + margin-right: 10px; + vertical-align: top; +} + +.storybook-page .tip-wrapper { + font-size: 13px; + line-height: 20px; + margin-top: 40px; + margin-bottom: 40px; +} + +.storybook-page .tip-wrapper svg { + display: inline-block; + height: 12px; + width: 12px; + margin-right: 4px; + vertical-align: top; + margin-top: 3px; +} + +.storybook-page .tip-wrapper svg path { + fill: #1ea7fd; +}