From 40c0a3e8012c75d3bddd68cb185533ab5117cba8 Mon Sep 17 00:00:00 2001 From: jokurebayashi <21.j.kurebayashi.nutfes@gmail.com> Date: Sat, 13 Jul 2024 14:59:21 +0900 Subject: [PATCH 1/4] [add]DeleteModal.stories EditModal OpenAddModalButton OpenDeleteModalButton OpenEditModalButton SponsorStyleAddModal --- .../components/sponsorstyles/DeleteModal.tsx | 3 +- .../components/sponsorstyles/EditModal.tsx | 2 +- .../sponsorstyles/OpenAddModalButton.tsx | 2 +- .../sponsorstyles/OpenDeleteModalButton.tsx | 2 +- .../sponsorstyles/OpenEditModalButton.tsx | 2 +- .../sponsorstyles/SponsorStyleAddModal.tsx | 2 +- .../src/components/sponsorstyles/index.ts | 6 ++++ .../sponsorstyles/DeleteModal.stories.tsx | 18 +++++++++++ .../sponsorstyles/EditModal.stories.tsx | 31 +++++++++++++++++++ .../OpenAddModalButton.stories.tsx | 18 +++++++++++ .../OpenDeleteModalButton.stories.tsx | 21 +++++++++++++ .../OpenEditModalButton.stories.tsx | 31 +++++++++++++++++++ .../SponsorStyleAddModal.stories.tsx | 20 ++++++++++++ 13 files changed, 151 insertions(+), 7 deletions(-) create mode 100644 view/next-project/src/components/sponsorstyles/index.ts create mode 100644 view/next-project/src/stories/sponsorstyles/DeleteModal.stories.tsx create mode 100644 view/next-project/src/stories/sponsorstyles/EditModal.stories.tsx create mode 100644 view/next-project/src/stories/sponsorstyles/OpenAddModalButton.stories.tsx create mode 100644 view/next-project/src/stories/sponsorstyles/OpenDeleteModalButton.stories.tsx create mode 100644 view/next-project/src/stories/sponsorstyles/OpenEditModalButton.stories.tsx create mode 100644 view/next-project/src/stories/sponsorstyles/SponsorStyleAddModal.stories.tsx diff --git a/view/next-project/src/components/sponsorstyles/DeleteModal.tsx b/view/next-project/src/components/sponsorstyles/DeleteModal.tsx index 74e8f3ad8..f4fd0ae2c 100644 --- a/view/next-project/src/components/sponsorstyles/DeleteModal.tsx +++ b/view/next-project/src/components/sponsorstyles/DeleteModal.tsx @@ -1,10 +1,9 @@ import { useRouter } from 'next/router'; import React, { Dispatch, FC, SetStateAction } from 'react'; - import { del } from '@api/api_methods'; import { Modal, CloseButton, OutlinePrimaryButton, PrimaryButton } from '@components/common'; -interface ModalProps { +export interface ModalProps { setShowModal: Dispatch>; children?: React.ReactNode; id: number | string; diff --git a/view/next-project/src/components/sponsorstyles/EditModal.tsx b/view/next-project/src/components/sponsorstyles/EditModal.tsx index 94555608b..d3d12dd78 100644 --- a/view/next-project/src/components/sponsorstyles/EditModal.tsx +++ b/view/next-project/src/components/sponsorstyles/EditModal.tsx @@ -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 { sponsorStyleId: number; sponsorStyle: SponsorStyle; setIsOpen: (isOpen: boolean) => void; diff --git a/view/next-project/src/components/sponsorstyles/OpenAddModalButton.tsx b/view/next-project/src/components/sponsorstyles/OpenAddModalButton.tsx index 9968faacd..265349617 100644 --- a/view/next-project/src/components/sponsorstyles/OpenAddModalButton.tsx +++ b/view/next-project/src/components/sponsorstyles/OpenAddModalButton.tsx @@ -3,7 +3,7 @@ import React, { useState } from 'react'; import SponsorStyleAddModal from './SponsorStyleAddModal'; import { AddButton } from '@components/common'; -interface Props { +export interface Props { children?: React.ReactNode; } diff --git a/view/next-project/src/components/sponsorstyles/OpenDeleteModalButton.tsx b/view/next-project/src/components/sponsorstyles/OpenDeleteModalButton.tsx index 0692d269e..c39d4198e 100644 --- a/view/next-project/src/components/sponsorstyles/OpenDeleteModalButton.tsx +++ b/view/next-project/src/components/sponsorstyles/OpenDeleteModalButton.tsx @@ -3,7 +3,7 @@ import React, { useState } from 'react'; import DeleteModal from './DeleteModal'; import { DeleteButton } from '@components/common'; -interface Props { +export interface Props { children?: React.ReactNode; id: number; } diff --git a/view/next-project/src/components/sponsorstyles/OpenEditModalButton.tsx b/view/next-project/src/components/sponsorstyles/OpenEditModalButton.tsx index bf8919db7..3deddfaa9 100644 --- a/view/next-project/src/components/sponsorstyles/OpenEditModalButton.tsx +++ b/view/next-project/src/components/sponsorstyles/OpenEditModalButton.tsx @@ -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 { children?: React.ReactNode; id: number; sponsorStyle: SponsorStyle; diff --git a/view/next-project/src/components/sponsorstyles/SponsorStyleAddModal.tsx b/view/next-project/src/components/sponsorstyles/SponsorStyleAddModal.tsx index 3af8dc596..49739acd0 100644 --- a/view/next-project/src/components/sponsorstyles/SponsorStyleAddModal.tsx +++ b/view/next-project/src/components/sponsorstyles/SponsorStyleAddModal.tsx @@ -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 { setIsOpen: (isOpen: boolean) => void; } diff --git a/view/next-project/src/components/sponsorstyles/index.ts b/view/next-project/src/components/sponsorstyles/index.ts new file mode 100644 index 000000000..c00d4221a --- /dev/null +++ b/view/next-project/src/components/sponsorstyles/index.ts @@ -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'; diff --git a/view/next-project/src/stories/sponsorstyles/DeleteModal.stories.tsx b/view/next-project/src/stories/sponsorstyles/DeleteModal.stories.tsx new file mode 100644 index 000000000..e16e11b09 --- /dev/null +++ b/view/next-project/src/stories/sponsorstyles/DeleteModal.stories.tsx @@ -0,0 +1,18 @@ +import { Meta } from '@storybook/react'; +import { DeleteModal } from '@components/sponsorstyles'; + +const meta: Meta = { + title: 'FinanSu/sponsorstyles/DeleteModal', + component: DeleteModal, + tags: ['autodocs'], + argTypes: {}, +}; + +export default meta; + +export const Primary = { + args: { + className: 'm-10', + children:

children

, + }, +}; diff --git a/view/next-project/src/stories/sponsorstyles/EditModal.stories.tsx b/view/next-project/src/stories/sponsorstyles/EditModal.stories.tsx new file mode 100644 index 000000000..7a271ad3d --- /dev/null +++ b/view/next-project/src/stories/sponsorstyles/EditModal.stories.tsx @@ -0,0 +1,31 @@ +import React, { useState } from 'react'; +import { Meta, StoryFn } from '@storybook/react'; +import EditModal from '@components/sponsorstyles/EditModal'; +import { SponsorStyle } from '@type/common'; // SponsorStyle 型のインポートを確認してください + +const meta: Meta = { + title: 'FinanSu/sponsorstyles/EditModal', + component: EditModal, + tags: ['autodocs'], + argTypes: {}, +}; + +export default meta; + +const Template: StoryFn = (args) => { + const [isOpen, setIsOpen] = useState(true); + return ; +}; + +const sampleSponsorStyle: SponsorStyle = { + id: 1, + style: 'Premium', + feature: 'Featured on homepage', + price: 20000, +}; + +export const Primary = Template.bind({}); +Primary.args = { + sponsorStyleId: 123, + sponsorStyle: sampleSponsorStyle, +}; diff --git a/view/next-project/src/stories/sponsorstyles/OpenAddModalButton.stories.tsx b/view/next-project/src/stories/sponsorstyles/OpenAddModalButton.stories.tsx new file mode 100644 index 000000000..ccdf0feb7 --- /dev/null +++ b/view/next-project/src/stories/sponsorstyles/OpenAddModalButton.stories.tsx @@ -0,0 +1,18 @@ +import { Meta } from '@storybook/react'; +import { OpenAddModalButton } from '@components/sponsorstyles'; + +const meta: Meta = { + title: 'FinanSu/sponsorstyles/OpenAddModalButton', + component: OpenAddModalButton, + tags: ['autodocs'], + argTypes: {}, +}; + +export default meta; + +export const Primary = { + args: { + className: 'm-10', + children:

children

, + }, +}; diff --git a/view/next-project/src/stories/sponsorstyles/OpenDeleteModalButton.stories.tsx b/view/next-project/src/stories/sponsorstyles/OpenDeleteModalButton.stories.tsx new file mode 100644 index 000000000..353e12c45 --- /dev/null +++ b/view/next-project/src/stories/sponsorstyles/OpenDeleteModalButton.stories.tsx @@ -0,0 +1,21 @@ +import { Meta, StoryFn } from '@storybook/react'; +import { OpenDeleteModalButton } from '@components/sponsorstyles'; +import { Props } from '@components/sponsorstyles/OpenDeleteModalButton'; + +const meta: Meta = { + title: 'FinanSu/sponsorstyles/OpenDeleteModalButton', + component: OpenDeleteModalButton, + tags: ['autodocs'], + argTypes: {}, +}; + +export default meta; + +const Template: StoryFn = (args) => ; + +export const Primary = { + args: { + className: 'm-10', + children:

children

, + }, +}; diff --git a/view/next-project/src/stories/sponsorstyles/OpenEditModalButton.stories.tsx b/view/next-project/src/stories/sponsorstyles/OpenEditModalButton.stories.tsx new file mode 100644 index 000000000..57b393279 --- /dev/null +++ b/view/next-project/src/stories/sponsorstyles/OpenEditModalButton.stories.tsx @@ -0,0 +1,31 @@ +import { Meta, StoryFn } from '@storybook/react'; +import { Props } from '@components/sponsorstyles/OpenEditModalButton'; +import { OpenEditModalButton } from '@components/sponsorstyles'; +import { SponsorStyle } from '@type/common'; + +// メタデータ定義 +const meta: Meta = { + 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 = (args) => ; + +export const Primary = Template.bind({}); +Primary.args = { + id: 1, + sponsorStyle: sampleSponsorStyle, + children:

Sample Child

, +}; diff --git a/view/next-project/src/stories/sponsorstyles/SponsorStyleAddModal.stories.tsx b/view/next-project/src/stories/sponsorstyles/SponsorStyleAddModal.stories.tsx new file mode 100644 index 000000000..4554917c1 --- /dev/null +++ b/view/next-project/src/stories/sponsorstyles/SponsorStyleAddModal.stories.tsx @@ -0,0 +1,20 @@ +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 = (args) => ( + +); + +export const Primary = Template.bind({}); +Primary.args = { +}; From 7fb66fb8fb404b5310c4dafc302aaa897f46fb23 Mon Sep 17 00:00:00 2001 From: jokurebayashi Date: Sat, 13 Jul 2024 06:03:10 +0000 Subject: [PATCH 2/4] formatted by workflow --- .../src/stories/sponsorstyles/EditModal.stories.tsx | 2 +- .../stories/sponsorstyles/OpenEditModalButton.stories.tsx | 2 +- .../stories/sponsorstyles/SponsorStyleAddModal.stories.tsx | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/view/next-project/src/stories/sponsorstyles/EditModal.stories.tsx b/view/next-project/src/stories/sponsorstyles/EditModal.stories.tsx index 7a271ad3d..fb7299f4e 100644 --- a/view/next-project/src/stories/sponsorstyles/EditModal.stories.tsx +++ b/view/next-project/src/stories/sponsorstyles/EditModal.stories.tsx @@ -1,5 +1,5 @@ -import React, { useState } from 'react'; import { Meta, StoryFn } from '@storybook/react'; +import React, { useState } from 'react'; import EditModal from '@components/sponsorstyles/EditModal'; import { SponsorStyle } from '@type/common'; // SponsorStyle 型のインポートを確認してください diff --git a/view/next-project/src/stories/sponsorstyles/OpenEditModalButton.stories.tsx b/view/next-project/src/stories/sponsorstyles/OpenEditModalButton.stories.tsx index 57b393279..7a5ba8168 100644 --- a/view/next-project/src/stories/sponsorstyles/OpenEditModalButton.stories.tsx +++ b/view/next-project/src/stories/sponsorstyles/OpenEditModalButton.stories.tsx @@ -1,6 +1,6 @@ import { Meta, StoryFn } from '@storybook/react'; -import { Props } from '@components/sponsorstyles/OpenEditModalButton'; import { OpenEditModalButton } from '@components/sponsorstyles'; +import { Props } from '@components/sponsorstyles/OpenEditModalButton'; import { SponsorStyle } from '@type/common'; // メタデータ定義 diff --git a/view/next-project/src/stories/sponsorstyles/SponsorStyleAddModal.stories.tsx b/view/next-project/src/stories/sponsorstyles/SponsorStyleAddModal.stories.tsx index 4554917c1..7b108b647 100644 --- a/view/next-project/src/stories/sponsorstyles/SponsorStyleAddModal.stories.tsx +++ b/view/next-project/src/stories/sponsorstyles/SponsorStyleAddModal.stories.tsx @@ -11,10 +11,7 @@ const meta: Meta = { export default meta; -const Template: StoryFn = (args) => ( - -); +const Template: StoryFn = (args) => ; export const Primary = Template.bind({}); -Primary.args = { -}; +Primary.args = {}; From 11c7b1db0e752df1a1b2f4ff30db3d50499b8583 Mon Sep 17 00:00:00 2001 From: jokurebayashi <21.j.kurebayashi.nutfes@gmail.com> Date: Thu, 18 Jul 2024 21:50:54 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[fix]export=E6=96=87=E3=81=AE=E5=89=8A?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/next-project/src/components/sponsorstyles/DeleteModal.tsx | 2 +- view/next-project/src/components/sponsorstyles/EditModal.tsx | 2 +- .../src/components/sponsorstyles/OpenAddModalButton.tsx | 2 +- .../src/components/sponsorstyles/OpenDeleteModalButton.tsx | 2 +- .../src/components/sponsorstyles/OpenEditModalButton.tsx | 2 +- .../src/components/sponsorstyles/SponsorStyleAddModal.tsx | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/view/next-project/src/components/sponsorstyles/DeleteModal.tsx b/view/next-project/src/components/sponsorstyles/DeleteModal.tsx index f4fd0ae2c..ea31bf875 100644 --- a/view/next-project/src/components/sponsorstyles/DeleteModal.tsx +++ b/view/next-project/src/components/sponsorstyles/DeleteModal.tsx @@ -3,7 +3,7 @@ import React, { Dispatch, FC, SetStateAction } from 'react'; import { del } from '@api/api_methods'; import { Modal, CloseButton, OutlinePrimaryButton, PrimaryButton } from '@components/common'; -export interface ModalProps { +interface ModalProps { setShowModal: Dispatch>; children?: React.ReactNode; id: number | string; diff --git a/view/next-project/src/components/sponsorstyles/EditModal.tsx b/view/next-project/src/components/sponsorstyles/EditModal.tsx index d3d12dd78..94555608b 100644 --- a/view/next-project/src/components/sponsorstyles/EditModal.tsx +++ b/view/next-project/src/components/sponsorstyles/EditModal.tsx @@ -5,7 +5,7 @@ import { put } from '@api/api_methods'; import { PrimaryButton, OutlinePrimaryButton, CloseButton, Input, Modal } from '@components/common'; import { SponsorStyle } from '@type/common'; -export interface ModalProps { +interface ModalProps { sponsorStyleId: number; sponsorStyle: SponsorStyle; setIsOpen: (isOpen: boolean) => void; diff --git a/view/next-project/src/components/sponsorstyles/OpenAddModalButton.tsx b/view/next-project/src/components/sponsorstyles/OpenAddModalButton.tsx index 265349617..9968faacd 100644 --- a/view/next-project/src/components/sponsorstyles/OpenAddModalButton.tsx +++ b/view/next-project/src/components/sponsorstyles/OpenAddModalButton.tsx @@ -3,7 +3,7 @@ import React, { useState } from 'react'; import SponsorStyleAddModal from './SponsorStyleAddModal'; import { AddButton } from '@components/common'; -export interface Props { +interface Props { children?: React.ReactNode; } diff --git a/view/next-project/src/components/sponsorstyles/OpenDeleteModalButton.tsx b/view/next-project/src/components/sponsorstyles/OpenDeleteModalButton.tsx index c39d4198e..0692d269e 100644 --- a/view/next-project/src/components/sponsorstyles/OpenDeleteModalButton.tsx +++ b/view/next-project/src/components/sponsorstyles/OpenDeleteModalButton.tsx @@ -3,7 +3,7 @@ import React, { useState } from 'react'; import DeleteModal from './DeleteModal'; import { DeleteButton } from '@components/common'; -export interface Props { +interface Props { children?: React.ReactNode; id: number; } diff --git a/view/next-project/src/components/sponsorstyles/OpenEditModalButton.tsx b/view/next-project/src/components/sponsorstyles/OpenEditModalButton.tsx index 3deddfaa9..bf8919db7 100644 --- a/view/next-project/src/components/sponsorstyles/OpenEditModalButton.tsx +++ b/view/next-project/src/components/sponsorstyles/OpenEditModalButton.tsx @@ -5,7 +5,7 @@ import { EditButton } from '@components/common'; import EditModal from '@components/sponsorstyles/EditModal'; import { SponsorStyle } from '@type/common'; -export interface Props { +interface Props { children?: React.ReactNode; id: number; sponsorStyle: SponsorStyle; diff --git a/view/next-project/src/components/sponsorstyles/SponsorStyleAddModal.tsx b/view/next-project/src/components/sponsorstyles/SponsorStyleAddModal.tsx index 49739acd0..3af8dc596 100644 --- a/view/next-project/src/components/sponsorstyles/SponsorStyleAddModal.tsx +++ b/view/next-project/src/components/sponsorstyles/SponsorStyleAddModal.tsx @@ -5,7 +5,7 @@ import { post } from '@api/api_methods'; import { CloseButton, Input, Modal, PrimaryButton } from '@components/common'; import { SponsorStyle } from '@type/common'; -export interface ModalProps { +interface ModalProps { setIsOpen: (isOpen: boolean) => void; } From 25e5b629fee30d8ddc3feb792fbc7158eccc1efe Mon Sep 17 00:00:00 2001 From: jokurebayashi <21.j.kurebayashi.nutfes@gmail.com> Date: Tue, 23 Jul 2024 19:07:29 +0900 Subject: [PATCH 4/4] [fix]lint error --- .../src/components/sponsorstyles/OpenDeleteModalButton.tsx | 2 +- .../src/components/sponsorstyles/OpenEditModalButton.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/view/next-project/src/components/sponsorstyles/OpenDeleteModalButton.tsx b/view/next-project/src/components/sponsorstyles/OpenDeleteModalButton.tsx index 0692d269e..c39d4198e 100644 --- a/view/next-project/src/components/sponsorstyles/OpenDeleteModalButton.tsx +++ b/view/next-project/src/components/sponsorstyles/OpenDeleteModalButton.tsx @@ -3,7 +3,7 @@ import React, { useState } from 'react'; import DeleteModal from './DeleteModal'; import { DeleteButton } from '@components/common'; -interface Props { +export interface Props { children?: React.ReactNode; id: number; } diff --git a/view/next-project/src/components/sponsorstyles/OpenEditModalButton.tsx b/view/next-project/src/components/sponsorstyles/OpenEditModalButton.tsx index bf8919db7..3deddfaa9 100644 --- a/view/next-project/src/components/sponsorstyles/OpenEditModalButton.tsx +++ b/view/next-project/src/components/sponsorstyles/OpenEditModalButton.tsx @@ -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 { children?: React.ReactNode; id: number; sponsorStyle: SponsorStyle;