-
Notifications
You must be signed in to change notification settings - Fork 2
Storybookに既存コンポーネントを表示する(/sponsorstyles) #847
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: develop
Are you sure you want to change the base?
Changes from 2 commits
40c0a3e
7fb66fb
11c7b1d
6a45aaa
25e5b62
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,7 +5,7 @@ import { put } from '@api/api_methods'; | |||||
| import { PrimaryButton, OutlinePrimaryButton, CloseButton, Input, Modal } from '@components/common'; | ||||||
| import { SponsorStyle } from '@type/common'; | ||||||
|
|
||||||
| interface ModalProps { | ||||||
| export interface ModalProps { | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
ここも! |
||||||
| sponsorStyleId: number; | ||||||
| sponsorStyle: SponsorStyle; | ||||||
| setIsOpen: (isOpen: boolean) => void; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,7 +3,7 @@ import React, { useState } from 'react'; | |||||
| import SponsorStyleAddModal from './SponsorStyleAddModal'; | ||||||
| import { AddButton } from '@components/common'; | ||||||
|
|
||||||
| interface Props { | ||||||
| export interface Props { | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
ここも! |
||||||
| children?: React.ReactNode; | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,7 +3,7 @@ import React, { useState } from 'react'; | |||||
| import DeleteModal from './DeleteModal'; | ||||||
| import { DeleteButton } from '@components/common'; | ||||||
|
|
||||||
| interface Props { | ||||||
| export interface Props { | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
ここも!
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ここexportの削除お願いします! |
||||||
| children?: React.ReactNode; | ||||||
| id: number; | ||||||
| } | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,7 +5,7 @@ import { EditButton } from '@components/common'; | |||||
| import EditModal from '@components/sponsorstyles/EditModal'; | ||||||
| import { SponsorStyle } from '@type/common'; | ||||||
|
|
||||||
| interface Props { | ||||||
| export interface Props { | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ここもです |
||||||
| children?: React.ReactNode; | ||||||
| id: number; | ||||||
| sponsorStyle: SponsorStyle; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,7 +5,7 @@ import { post } from '@api/api_methods'; | |||||
| import { CloseButton, Input, Modal, PrimaryButton } from '@components/common'; | ||||||
| import { SponsorStyle } from '@type/common'; | ||||||
|
|
||||||
| interface ModalProps { | ||||||
| export interface ModalProps { | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| setIsOpen: (isOpen: boolean) => void; | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| export { default as DeleteModal } from './DeleteModal'; | ||
| export { default as EditModal } from './EditModal'; | ||
| export { default as OpenAddModalButton } from './OpenAddModalButton'; | ||
| export { default as OpenDeleteModalButton } from './OpenDeleteModalButton'; | ||
| export { default as OpenEditModalButton } from './OpenEditModalButton'; | ||
| export { default as SponsorStyleAddModal } from './SponsorStyleAddModal'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { Meta } from '@storybook/react'; | ||
| import { DeleteModal } from '@components/sponsorstyles'; | ||
|
|
||
| const meta: Meta<typeof DeleteModal> = { | ||
| title: 'FinanSu/sponsorstyles/DeleteModal', | ||
| component: DeleteModal, | ||
| tags: ['autodocs'], | ||
| argTypes: {}, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| export const Primary = { | ||
| args: { | ||
| className: 'm-10', | ||
| children: <h1>children</h1>, | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { Meta, StoryFn } from '@storybook/react'; | ||
| import React, { useState } from 'react'; | ||
| import EditModal from '@components/sponsorstyles/EditModal'; | ||
| import { SponsorStyle } from '@type/common'; // SponsorStyle 型のインポートを確認してください | ||
|
|
||
| const meta: Meta<typeof EditModal> = { | ||
| title: 'FinanSu/sponsorstyles/EditModal', | ||
| component: EditModal, | ||
| tags: ['autodocs'], | ||
| argTypes: {}, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| const Template: StoryFn<typeof EditModal> = (args) => { | ||
| const [isOpen, setIsOpen] = useState(true); | ||
| return <EditModal {...args} setIsOpen={setIsOpen} />; | ||
| }; | ||
|
|
||
| const sampleSponsorStyle: SponsorStyle = { | ||
| id: 1, | ||
| style: 'Premium', | ||
| feature: 'Featured on homepage', | ||
| price: 20000, | ||
| }; | ||
|
|
||
| export const Primary = Template.bind({}); | ||
| Primary.args = { | ||
| sponsorStyleId: 123, | ||
| sponsorStyle: sampleSponsorStyle, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { Meta } from '@storybook/react'; | ||
| import { OpenAddModalButton } from '@components/sponsorstyles'; | ||
|
|
||
| const meta: Meta<typeof OpenAddModalButton> = { | ||
| title: 'FinanSu/sponsorstyles/OpenAddModalButton', | ||
| component: OpenAddModalButton, | ||
| tags: ['autodocs'], | ||
| argTypes: {}, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| export const Primary = { | ||
| args: { | ||
| className: 'm-10', | ||
| children: <h1>children</h1>, | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { Meta, StoryFn } from '@storybook/react'; | ||
| import { OpenDeleteModalButton } from '@components/sponsorstyles'; | ||
| import { Props } from '@components/sponsorstyles/OpenDeleteModalButton'; | ||
|
|
||
| const meta: Meta<typeof OpenDeleteModalButton> = { | ||
| title: 'FinanSu/sponsorstyles/OpenDeleteModalButton', | ||
| component: OpenDeleteModalButton, | ||
| tags: ['autodocs'], | ||
| argTypes: {}, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| const Template: StoryFn<Props> = (args) => <OpenDeleteModalButton {...args} />; | ||
|
|
||
| export const Primary = { | ||
| args: { | ||
| className: 'm-10', | ||
| children: <h1>children</h1>, | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { Meta, StoryFn } from '@storybook/react'; | ||
| import { OpenEditModalButton } from '@components/sponsorstyles'; | ||
| import { Props } from '@components/sponsorstyles/OpenEditModalButton'; | ||
| import { SponsorStyle } from '@type/common'; | ||
|
|
||
| // メタデータ定義 | ||
| const meta: Meta<typeof OpenEditModalButton> = { | ||
| title: 'FinanSu/sponsorstyles/OpenEditModalButton', | ||
| component: OpenEditModalButton, | ||
| tags: ['autodocs'], | ||
| argTypes: {}, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| // 仮のSponsorStyleデータ | ||
| const sampleSponsorStyle: SponsorStyle = { | ||
| id: 1, | ||
| style: 'Sample Style', | ||
| feature: 'Sample Feature', | ||
| price: 1000, | ||
| }; | ||
|
|
||
| const Template: StoryFn<Props> = (args) => <OpenEditModalButton {...args} />; | ||
|
|
||
| export const Primary = Template.bind({}); | ||
| Primary.args = { | ||
| id: 1, | ||
| sponsorStyle: sampleSponsorStyle, | ||
| children: <h1>Sample Child</h1>, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { Meta, StoryFn } from '@storybook/react'; | ||
| import React from 'react'; | ||
| import { SponsorStyleAddModal } from '@components/sponsorstyles'; | ||
|
|
||
| const meta: Meta = { | ||
| title: 'FinanSu/sponsorstyles/SponsorStyleAddModal', | ||
| component: SponsorStyleAddModal, | ||
| argTypes: {}, | ||
| tags: ['autodocs'], | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| const Template: StoryFn<typeof SponsorStyleAddModal> = (args) => <SponsorStyleAddModal {...args} />; | ||
|
|
||
| export const Primary = Template.bind({}); | ||
| Primary.args = {}; |
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.
ModalPropsは使っていなので、exportしなくていいかと思います!