-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BaseコンポーネントのStorybookファイルを作成 #2227
Merged
Hiroshiba
merged 10 commits into
VOICEVOX:main
from
takusea:create-storybook-base-components
Aug 21, 2024
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a693428
storybook/addon-themesを導入
takusea 940cb81
Baseコンポーネントのstorybookファイルを追加
takusea 740e38d
文字色を付与
takusea be313fe
onLabel/offLabelをcheckedLabel/uncheckedLabelに改名
takusea 95c130b
lintを適用
takusea b6c4323
typecheckエラーを修正
takusea 79fb8c6
test-storybookのtimeoutを倍の時間に変更
takusea c2cb5d2
冗長な記述を削除
takusea 124d79f
clickableのStoryを追加
takusea 713537a
test-storybookのtimeoutを更に倍に変更
takusea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,68 @@ | ||
import type { Meta, StoryObj } from "@storybook/vue3"; | ||
|
||
import BaseButton from "./BaseButton.vue"; | ||
|
||
const meta: Meta<typeof BaseButton> = { | ||
component: BaseButton, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof BaseButton>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
label: "Default", | ||
variant: "default", | ||
icon: "settings", | ||
}, | ||
|
||
render: (args) => ({ | ||
components: { BaseButton }, | ||
|
||
setup() { | ||
return { args }; | ||
}, | ||
|
||
template: '<BaseButton v-bind="args" />', | ||
}), | ||
}; | ||
|
||
export const Primary: Story = { | ||
args: { | ||
label: "Primary", | ||
variant: "primary", | ||
icon: "settings", | ||
}, | ||
|
||
render: (args) => ({ | ||
components: { | ||
BaseButton, | ||
}, | ||
|
||
setup() { | ||
return { args }; | ||
}, | ||
|
||
template: '<BaseButton v-bind="args" />', | ||
}), | ||
}; | ||
|
||
export const Danger: Story = { | ||
args: { | ||
label: "Danger", | ||
variant: "danger", | ||
icon: "settings", | ||
}, | ||
|
||
render: (args) => ({ | ||
components: { | ||
BaseButton, | ||
}, | ||
|
||
setup() { | ||
return { args }; | ||
}, | ||
|
||
template: '<BaseButton v-bind="args" />', | ||
}), | ||
}; |
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,76 @@ | ||
import type { Meta, StoryObj } from "@storybook/vue3"; | ||
|
||
import BaseDocumentView from "./BaseDocumentView.vue"; | ||
|
||
const meta: Meta<typeof BaseDocumentView> = { | ||
component: BaseDocumentView, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof BaseDocumentView>; | ||
|
||
export const Default: Story = { | ||
render: (args) => ({ | ||
components: { BaseDocumentView }, | ||
|
||
setup() { | ||
return { args }; | ||
}, | ||
|
||
template: ` | ||
<BaseDocumentView> | ||
<h1>Heading 1</h1> | ||
<h2>Heading 2</h2> | ||
<h3>Heading 3</h3> | ||
<h4>Heading 4</h4> | ||
<h5>Heading 5</h5> | ||
<h6>Heading 6</h6> | ||
<p>ParagraphParagraph<a href="#">Link</a>ParagraphParagraph<code>code</code>ParagraphParagraph</p> | ||
<ul> | ||
<li>List</li> | ||
<li>List</li> | ||
<li>List</li> | ||
</ul> | ||
<ol> | ||
<li>List</li> | ||
<li>List</li> | ||
<li>List</li> | ||
</ol> | ||
<pre>pre</pre> | ||
<details> | ||
<summary>summary</summary> | ||
<p>Details</p> | ||
</details> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Table Header</th> | ||
<th>Table Header</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>Table</td> | ||
<td>Table</td> | ||
</tr> | ||
<tr> | ||
<td>Table</td> | ||
<td>Table</td> | ||
</tr> | ||
<tr> | ||
<td>Table</td> | ||
<td>Table</td> | ||
</tr> | ||
<tr> | ||
<td>Table</td> | ||
<td>Table</td> | ||
</tr> | ||
<tr> | ||
<td>Table</td> | ||
<td>Table</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</BaseDocumentView>`, | ||
}), | ||
}; |
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,41 @@ | ||
import type { Meta, StoryObj } from "@storybook/vue3"; | ||
|
||
import BaseListItem from "./BaseListItem.vue"; | ||
|
||
const meta: Meta<typeof BaseListItem> = { | ||
component: BaseListItem, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof BaseListItem>; | ||
|
||
export const Default: Story = { | ||
render: (args) => ({ | ||
components: { BaseListItem }, | ||
setup() { | ||
return { args }; | ||
}, | ||
template: '<BaseListItem v-bind="args">ListItem</BaseListItem>', | ||
}), | ||
args: { | ||
selected: false, | ||
}, | ||
Hiroshiba marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
|
||
export const Selected: Story = { | ||
args: { | ||
selected: true, | ||
}, | ||
|
||
render: (args) => ({ | ||
components: { | ||
BaseListItem, | ||
}, | ||
|
||
setup() { | ||
return { args }; | ||
}, | ||
|
||
template: '<BaseListItem v-bind="args">ListItem</BaseListItem>', | ||
}), | ||
}; | ||
Hiroshiba marked this conversation as resolved.
Show resolved
Hide resolved
|
Hiroshiba marked this conversation as resolved.
Show resolved
Hide resolved
|
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 @@ | ||
import type { Meta, StoryObj } from "@storybook/vue3"; | ||
|
||
import BaseRowCard from "./BaseRowCard.vue"; | ||
|
||
import BaseButton from "./BaseButton.vue"; | ||
|
||
const meta: Meta<typeof BaseRowCard> = { | ||
component: BaseRowCard, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof BaseRowCard>; | ||
|
||
export const Default: Story = { | ||
render: (args) => ({ | ||
components: { BaseRowCard, BaseButton }, | ||
setup() { | ||
return { args }; | ||
}, | ||
template: | ||
'<BaseRowCard v-bind="args"><BaseButton label="RightControl" /></BaseRowCard>', | ||
}), | ||
args: { | ||
title: "Title", | ||
description: "Description", | ||
}, | ||
}; |
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,24 @@ | ||
import type { Meta, StoryObj } from "@storybook/vue3"; | ||
|
||
import BaseScrollArea from "./BaseScrollArea.vue"; | ||
|
||
const meta: Meta<typeof BaseScrollArea> = { | ||
component: BaseScrollArea, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof BaseScrollArea>; | ||
|
||
export const Default: Story = { | ||
render: (args) => ({ | ||
components: { BaseScrollArea }, | ||
setup() { | ||
return { args }; | ||
}, | ||
template: | ||
'<BaseScrollArea style="width: 100%; height:480px" v-bind="args"><div style="width: 100%; height:4800px;"></div></BaseScrollArea>', | ||
}), | ||
args: { | ||
//👇 The args you need here will depend on your component | ||
}, | ||
Hiroshiba marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; |
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 type { Meta, StoryObj } from "@storybook/vue3"; | ||
|
||
import BaseSwitch from "./BaseSwitch.vue"; | ||
|
||
const meta: Meta<typeof BaseSwitch> = { | ||
component: BaseSwitch, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof BaseSwitch>; | ||
|
||
export const Unchecked: Story = { | ||
args: { | ||
uncheckedLabel: "Off", | ||
checkedLabel: "On", | ||
checked: false, | ||
}, | ||
|
||
render: (args) => ({ | ||
components: { BaseSwitch }, | ||
|
||
setup() { | ||
return { args }; | ||
}, | ||
|
||
template: '<BaseSwitch v-bind="args" />', | ||
}), | ||
Hiroshiba marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
|
||
export const Checked: Story = { | ||
args: { | ||
uncheckedLabel: "Off", | ||
checkedLabel: "On", | ||
checked: true, | ||
}, | ||
|
||
render: (args) => ({ | ||
components: { | ||
BaseSwitch, | ||
}, | ||
|
||
setup() { | ||
return { args }; | ||
}, | ||
|
||
template: '<BaseSwitch v-bind="args" />', | ||
}), | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Storybook、書式がコロコロ変わってよくわからないんですけど、多分この形(
Meta
で指定したComponentにargsを直接渡し、特に表示物も変更しない場合)はこの関数がまるまるいらないはずです!https://storybook.js.org/docs/api/csf#args-story-inputs
めちゃめちゃスリムになると思います 🙏