-
Notifications
You must be signed in to change notification settings - Fork 0
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
25 changed files
with
6,879 additions
and
102 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# vue3-multi-starter | ||
|
||
``` | ||
npx degit idmytro/vue3-multi-starter/minimal my-project | ||
npx degit idmytro/vue3-multi-starter/minimal myproject | ||
``` |
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 |
---|---|---|
@@ -1,7 +1,3 @@ | ||
# Vue 3 + Vite | ||
|
||
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more. | ||
|
||
## Recommended IDE Setup | ||
|
||
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin). | ||
npx degit idmytro/vue3-multi-starter/minimal myproject |
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,17 @@ | ||
/** @type { import('@storybook/vue3-vite').StorybookConfig } */ | ||
const config = { | ||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"], | ||
addons: [ | ||
"@storybook/addon-links", | ||
"@storybook/addon-essentials", | ||
"@storybook/addon-interactions", | ||
], | ||
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,14 @@ | ||
/** @type { import('@storybook/vue3').Preview } */ | ||
const preview = { | ||
parameters: { | ||
actions: { argTypesRegex: "^on[A-Z].*" }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
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 |
---|---|---|
@@ -1,7 +1,3 @@ | ||
# Vue 3 + Vite | ||
# Vue 3 + Vite + Storybook | ||
|
||
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more. | ||
|
||
## Recommended IDE Setup | ||
|
||
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin). | ||
npx degit idmytro/vue3-multi-starter/storybook my-project |
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 |
---|---|---|
@@ -1,18 +1,30 @@ | ||
{ | ||
"name": "minimal", | ||
"name": "storybook", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"preview": "vite preview" | ||
"preview": "vite preview", | ||
"storybook": "storybook dev -p 6006", | ||
"build-storybook": "storybook build" | ||
}, | ||
"dependencies": { | ||
"vue": "^3.2.45" | ||
}, | ||
"devDependencies": { | ||
"@storybook/addon-essentials": "^7.0.5", | ||
"@storybook/addon-interactions": "^7.0.5", | ||
"@storybook/addon-links": "^7.0.5", | ||
"@storybook/blocks": "^7.0.5", | ||
"@storybook/testing-library": "^0.0.14-next.2", | ||
"@storybook/vue3": "^7.0.5", | ||
"@storybook/vue3-vite": "^7.0.5", | ||
"@vitejs/plugin-vue": "^4.0.0", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"storybook": "^7.0.5", | ||
"vite": "^4.1.0" | ||
} | ||
} | ||
} |
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> | ||
<button type="button" :class="classes" @click="onClick" :style="style">{{ label }}</button> | ||
</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> |
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,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: '<my-header :user="user" />', | ||
}), | ||
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, | ||
}, | ||
}; |
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,59 @@ | ||
<template> | ||
<header> | ||
<div class="wrapper"> | ||
<div> | ||
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"> | ||
<g fill="none" fill-rule="evenodd"> | ||
<path | ||
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z" | ||
fill="#FFF" | ||
/> | ||
<path | ||
d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z" | ||
fill="#555AB9" | ||
/> | ||
<path | ||
d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z" | ||
fill="#91BAF8" | ||
/> | ||
</g> | ||
</svg> | ||
<h1>Acme</h1> | ||
</div> | ||
<div> | ||
<span class="welcome" v-if="user" | ||
>Welcome, <b>{{ user.name }}</b | ||
>!</span | ||
> | ||
<my-button size="small" @click="$emit('logout')" label="Log out" v-if="user" /> | ||
<my-button size="small" @click="$emit('login')" label="Log in" v-if="!user" /> | ||
<my-button | ||
primary | ||
size="small" | ||
@click="$emit('createAccount')" | ||
label="Sign up" | ||
v-if="!user" | ||
/> | ||
</div> | ||
</div> | ||
</header> | ||
</template> | ||
|
||
<script> | ||
import './header.css'; | ||
import MyButton from './Button.vue'; | ||
export default { | ||
name: 'my-header', | ||
components: { MyButton }, | ||
props: { | ||
user: { | ||
type: Object, | ||
}, | ||
}, | ||
emits: ['login', 'logout', 'createAccount'], | ||
}; | ||
</script> |
Oops, something went wrong.