Skip to content

Commit 4fcc846

Browse files
committed
docs(storybook): 일부 컴포넌트, 페이지 문서화 추가
1 parent 7ccf70e commit 4fcc846

File tree

5 files changed

+130
-0
lines changed

5 files changed

+130
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import EgovError from "@/components/EgovError";
2+
import { MemoryRouter } from "react-router-dom";
3+
4+
export default {
5+
title: "components/EgovError",
6+
component: EgovError,
7+
tags: ["autodocs"],
8+
argTypes: {
9+
msg: { control: "text" },
10+
},
11+
args: {
12+
msg: "다음과 같은 에러가 발생하였습니다.",
13+
},
14+
decorators: [
15+
(Story, context) => (
16+
<MemoryRouter
17+
key={context.args.msg}
18+
initialEntries={[
19+
{ pathname: "/error", state: { msg: context.args.msg } },
20+
]}
21+
>
22+
<Story />
23+
</MemoryRouter>
24+
),
25+
],
26+
};
27+
28+
export const Default = {};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import EgovPaging from "@/components/EgovPaging";
2+
import { useArgs } from "storybook/internal/preview-api";
3+
4+
export default {
5+
title: "components/EgovPaging",
6+
component: EgovPaging,
7+
tags: ["autodocs"],
8+
argTypes: {
9+
pagination: { control: "object" },
10+
},
11+
args: {
12+
pagination: {
13+
currentPageNo: 1,
14+
pageSize: 10,
15+
totalRecordCount: 1000,
16+
recordCountPerPage: 10,
17+
},
18+
},
19+
};
20+
21+
export const Interactive = (args) => {
22+
const [{ pagination }, updateArgs] = useArgs();
23+
24+
const handleMoveToPage = (page) => {
25+
updateArgs({
26+
pagination: {
27+
...pagination,
28+
currentPageNo: page,
29+
},
30+
});
31+
};
32+
33+
return <EgovPaging {...args} moveToPage={handleMoveToPage} />;
34+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import EgovRadioButtonGroup from "@/components/EgovRadioButtonGroup";
2+
import { useArgs } from "storybook/internal/preview-api";
3+
4+
export default {
5+
title: "components/EgovRadioButtonGroup",
6+
component: EgovRadioButtonGroup,
7+
parameters: {},
8+
tags: ["autodocs"],
9+
argTypes: {
10+
radioGroup: { control: "object" },
11+
setter: { action: "changed" },
12+
},
13+
args: {
14+
radioGroup: [
15+
{ label: "Radio 1", value: "radio1" },
16+
{ label: "Radio 2", value: "radio2" },
17+
{ label: "Radio 3", value: "radio3" },
18+
],
19+
name: "radioGroup",
20+
setValue: "radio1",
21+
},
22+
};
23+
24+
export const Default = (args) => {
25+
const [{ setValue }, updateArgs] = useArgs();
26+
27+
const handleChange = (newValue) => {
28+
updateArgs({ setValue: newValue });
29+
};
30+
31+
return <EgovRadioButtonGroup {...args} setter={handleChange} />;
32+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import EgovAdminBoardList from "@/pages/admin/board/EgovAdminBoardList";
2+
import { MemoryRouter } from "react-router-dom";
3+
4+
export default {
5+
title: "pages/admin/board/EgovAdminBoardList",
6+
component: EgovAdminBoardList,
7+
parameters: {},
8+
tags: ["autodocs"],
9+
decorators: [
10+
(Story) => (
11+
<MemoryRouter initialEntries={["/admin/board"]}>
12+
<Story />
13+
</MemoryRouter>
14+
),
15+
],
16+
};
17+
18+
export const Default = {};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import EgovLogin from "@/pages/login/EgovLogin";
2+
import { MemoryRouter } from "react-router-dom";
3+
4+
export default {
5+
title: "pages/login/EgovLogin",
6+
component: EgovLogin,
7+
parameters: {},
8+
tags: ["autodocs"],
9+
decorators: [
10+
(Story) => (
11+
<MemoryRouter initialEntries={["/login"]}>
12+
<Story />
13+
</MemoryRouter>
14+
),
15+
],
16+
};
17+
18+
export const Default = {};

0 commit comments

Comments
 (0)