-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* init storybook * stash * テスト動かしてみる * fmt * url * .env * READMEを更新 * ドキュメント整理 * trim no open * 不要なconsole.log
- Loading branch information
Showing
14 changed files
with
17,269 additions
and
5,365 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
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,27 @@ | ||
# Chromaticにmainブランチをpushする | ||
# お試し運用中なので消滅する可能性あり | ||
|
||
# TODO: Enable TurboSnap | ||
# https://www.chromatic.com/docs/github-actions/#enable-turbosnap | ||
|
||
name: "Chromatic" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
chromatic: | ||
name: Run Chromatic | ||
runs-on: ubuntu-latest | ||
if: github.repository_owner == 'VOICEVOX' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup environment | ||
uses: ./.github/actions/setup-environment | ||
- name: Run Chromatic | ||
uses: chromaui/action@v11 | ||
with: | ||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | ||
exitZeroOnChanges: true |
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
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
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,19 @@ | ||
import type { StorybookConfig } from "@storybook/vue3-vite"; | ||
|
||
const config: StorybookConfig = { | ||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], | ||
addons: [ | ||
"@storybook/addon-links", | ||
"@storybook/addon-essentials", | ||
"@chromatic-com/storybook", | ||
"@storybook/addon-interactions", | ||
], | ||
framework: { | ||
name: "@storybook/vue3-vite", | ||
options: { | ||
docgen: "vue-component-meta", | ||
}, | ||
}, | ||
}; | ||
|
||
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,40 @@ | ||
import { setup, Preview } from "@storybook/vue3"; | ||
import { Quasar, Dialog, Loading, Notify } from "quasar"; | ||
import iconSet from "quasar/icon-set/material-icons"; | ||
import { addActionsWithEmits } from "./utils/argTypesEnhancers"; | ||
import { markdownItPlugin } from "@/plugins/markdownItPlugin"; | ||
|
||
import "@quasar/extras/material-icons/material-icons.css"; | ||
import "quasar/dist/quasar.sass"; | ||
import "../src/styles/_index.scss"; | ||
|
||
setup((app) => { | ||
app.use(Quasar, { | ||
config: { | ||
brand: { | ||
primary: "#a5d4ad", | ||
secondary: "#212121", | ||
negative: "var(--color-warning)", | ||
}, | ||
}, | ||
iconSet, | ||
plugins: { | ||
Dialog, | ||
Loading, | ||
Notify, | ||
}, | ||
}); | ||
app.use(markdownItPlugin); | ||
}); | ||
|
||
const preview: Preview = { | ||
tags: ["autodocs"], | ||
parameters: { | ||
docs: { | ||
toc: true, | ||
}, | ||
}, | ||
argTypesEnhancers: [addActionsWithEmits], | ||
}; | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* Vue で emit されるイベントを Storybook の Controls に表示するための argTypesEnhancer | ||
* https://zenn.dev/shota_kamezawa/articles/36cd647264656c#storybook-%E3%81%AE%E8%A8%AD%E5%AE%9A | ||
*/ | ||
|
||
import { toHandlerKey } from "vue"; | ||
import { type ArgTypesEnhancer, type StrictInputType } from "@storybook/types"; | ||
|
||
export const addActionsWithEmits: ArgTypesEnhancer = ({ argTypes }) => { | ||
const argTypesEntries = Object.entries(argTypes) | ||
.filter(([, argType]) => argType.table?.category === "events") | ||
.map(([name]) => { | ||
/** | ||
* 例:`click` という events に対して `onClick` という名称の argType + action を追加することで、 | ||
* v-on によるイベントのバインディングが可能となる | ||
* @see https://ja.vuejs.org/guide/extras/render-function.html#v-on | ||
*/ | ||
const newName = toHandlerKey(name); | ||
const newArgType: StrictInputType = { | ||
name: newName, | ||
action: name, | ||
table: { | ||
disable: true, // Controls には表示しない | ||
}, | ||
}; | ||
|
||
return [newName, newArgType] as const; | ||
}); | ||
|
||
return { | ||
...argTypes, | ||
...Object.fromEntries(argTypesEntries), | ||
}; | ||
}; |
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
Oops, something went wrong.