Skip to content

Commit

Permalink
[add]DeleteModal.stories.tsx EditModal.stories.tsx OpenDeleteModalBut…
Browse files Browse the repository at this point in the history
…ton.stories.tsx OpenEditModalButton.stories.tsx
  • Loading branch information
KurebayashiJo committed Jul 18, 2024
1 parent 187b565 commit 4ae1f05
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 2 deletions.
2 changes: 1 addition & 1 deletion view/next-project/src/components/users/DeleteModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { multiDel } from '@api/api_methods';
import { Modal, CloseButton, OutlinePrimaryButton, PrimaryButton } from '@components/common';
import { User } from '@type/common';

interface ModalProps {
export interface ModalProps {
setShowModal: Dispatch<SetStateAction<boolean>>;
children?: React.ReactNode;
deleteUsers?: { users: User[]; ids: number[] };
Expand Down
2 changes: 1 addition & 1 deletion view/next-project/src/components/users/EditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ROLES } from '@/constants/role';
import { put } from '@api/user';
import { Bureau, User } from '@type/common';

interface ModalProps {
export interface ModalProps {
setShowModal: Dispatch<SetStateAction<boolean>>;
id: number | string;
bureaus: Bureau[];
Expand Down
4 changes: 4 additions & 0 deletions view/next-project/src/components/users/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { default as DeleteModal } from './DeleteModal';
export { default as EditModal } from './EditModal';
export { default as OpenDeleteModalButton } from './OpenDeleteModalButton';
export { default as OpenEditModalButton } from './OpenEditModalButton';
18 changes: 18 additions & 0 deletions view/next-project/src/stories/users/DeleteModal.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Meta } from '@storybook/react';
import { DeleteModal } from '@components/users/';

const meta: Meta<typeof DeleteModal> = {
title: 'FinanSu/users/DeleteModal',
component: DeleteModal,
tags: ['autodocs'],
argTypes: {},
};

export default meta;

export const Primary = {
args: {
className: 'm-10',
children: <h1>children</h1>,
},
};
31 changes: 31 additions & 0 deletions view/next-project/src/stories/users/EditModal.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Meta, StoryFn } from '@storybook/react';
import { EditModal } from '@components/users'; // 名前のインポートを修正

const meta: Meta<typeof EditModal> = {
title: 'FinanSu/users/EditModal',
component: EditModal,
tags: ['autodocs'],
argTypes: {},
};

export default meta;

const Template: StoryFn<typeof EditModal> = (args) => <EditModal {...args} />;

export const Primary = Template.bind({});
Primary.args = {
setShowModal: () => {
// Add your implementation here
},
id: 1,
bureaus: [
{ id: 1, name: 'Bureau 1' },
{ id: 2, name: 'Bureau 2' },
],
user: {
id: 1,
name: 'John Doe',
bureauID: 1,
roleID: 1,
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Meta } from '@storybook/react';
import { OpenDeleteModalButton } from '@components/users';

const meta: Meta<typeof OpenDeleteModalButton> = {
title: 'FinanSu/users/OpenDeleteModalButton',
component: OpenDeleteModalButton,
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,18 @@
import { Meta } from '@storybook/react';
import { OpenEditModalButton } from '@components/users';

const meta: Meta<typeof OpenEditModalButton> = {
title: 'FinanSu/users/OpenEditModalButton',
component: OpenEditModalButton,
tags: ['autodocs'],
argTypes: {},
};

export default meta;

export const Primary = {
args: {
className: 'm-10',
children: <h1>children</h1>,
},
};

0 comments on commit 4ae1f05

Please sign in to comment.