-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
895 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<template> | ||
<v-app> | ||
<v-main> | ||
<slot name="story"></slot> | ||
</v-main> | ||
</v-app> | ||
</template> | ||
|
||
<script></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { withVuetify } from "storybook-addon-vuetify3/dist/decorators" | ||
|
||
export const decorators = [withVuetify] |
18 changes: 18 additions & 0 deletions
18
src/dispatch/static/dispatch/.storybook/withVuetifyTheme.decorator.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }), | ||
} | ||
) | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/dispatch/static/dispatch/src/stories/Button.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<template> | ||
<v-btn type="button" :class="classes" @click="onClick" :style="style">{{ label }}</v-btn> | ||
</template> | ||
|
||
<script> | ||
import "./button.css" | ||
import { reactive, computed } from "vue" | ||
export default { | ||
name: "my-button", | ||
props: { | ||
label: { | ||
type: String, | ||
required: true, | ||
}, | ||
primary: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
size: { | ||
type: String, | ||
validator: function (value) { | ||
return ["small", "medium", "large"].indexOf(value) !== -1 | ||
}, | ||
}, | ||
backgroundColor: { | ||
type: String, | ||
}, | ||
}, | ||
emits: ["click"], | ||
setup(props, { emit }) { | ||
props = reactive(props) | ||
return { | ||
classes: computed(() => ({ | ||
"storybook-button": true, | ||
"storybook-button--primary": props.primary, | ||
"storybook-button--secondary": !props.primary, | ||
[`storybook-button--${props.size || "medium"}`]: true, | ||
})), | ||
style: computed(() => ({ | ||
backgroundColor: props.backgroundColor, | ||
})), | ||
onClick() { | ||
emit("click") | ||
}, | ||
} | ||
}, | ||
} | ||
</script> |
Oops, something went wrong.