Skip to content

Commit 8d220d8

Browse files
committed
feat: input storybook 추가
1 parent 501da04 commit 8d220d8

File tree

3 files changed

+62
-12
lines changed

3 files changed

+62
-12
lines changed

src/components/Home/Home.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
import { useState } from "react";
2-
31
import styles from "@/components/Home/Home.module.scss";
42
import IconButton from "@/components/ui/IconButton/IconButton";
5-
import Input from "@/components/ui/Input/Input";
63
import Text from "@/components/ui/Text/Text";
74

85
const Home = () => {
9-
const [value, setValue] = useState("");
10-
116
return (
127
<div className={styles.Home}>
138
<div className={styles.HomeTitle}>
@@ -18,12 +13,6 @@ const Home = () => {
1813
손쉬운 음식 리뷰 작성
1914
</Text>
2015
</div>
21-
<Input
22-
type="text"
23-
placeholder="가게명을 입력해주세요"
24-
value={value}
25-
onChange={(e) => setValue(e.target.value)}
26-
/>
2716
<div className={styles.HomeImage}>
2817
<img src="/src/assets/img/img-graphic-logo.png" alt="mainLogo" />
2918
</div>

src/components/ui/Input/Input.module.scss

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
display: flex;
1111
align-items: center;
1212
gap: 0.625rem;
13-
z-index: 1;
1413

1514
&.style-primary {
1615
background-color: var(--color-white);
@@ -48,3 +47,22 @@
4847
line-height: 1.3125rem;
4948
}
5049
}
50+
51+
.InputStory {
52+
display: flex;
53+
flex-direction: column;
54+
gap: 1rem;
55+
56+
.Wrapper {
57+
display: flex;
58+
gap: 1rem;
59+
justify-content: center;
60+
align-items: center;
61+
width: 300px;
62+
}
63+
64+
.Text {
65+
font-size: 1.125rem;
66+
width: 120px;
67+
}
68+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import Input from "@/components/ui/Input/Input";
2+
import styles from "@/components/ui/Input/Input.module.scss";
3+
import type { InputProps } from "@/components/ui/Input/Input.types";
4+
5+
import type { Meta, StoryObj, StoryFn } from "@storybook/react";
6+
7+
const meta: Meta<typeof Input> = {
8+
title: "Example/Input",
9+
component: Input,
10+
parameters: {
11+
layout: "centered",
12+
},
13+
tags: ["!autodocs"],
14+
};
15+
16+
export default meta;
17+
18+
const Template: StoryFn<InputProps> = ({ ...props }) => (
19+
<Input type="text" placeholder="가게명을 입력해주세요" {...props} />
20+
);
21+
22+
export const Primary: StoryObj<InputProps> = {
23+
render: Template,
24+
args: {
25+
type: "text",
26+
variant: "primary",
27+
},
28+
};
29+
30+
export const VariantProps: StoryObj<typeof Input> = {
31+
render: () => (
32+
<div className={styles.InputStory}>
33+
<div className={styles.Wrapper}>
34+
<p className={styles.Text}>primary</p>
35+
<Input variant="primary" type="text" placeholder="가게명을 입력해주세요" />
36+
</div>
37+
<div className={styles.Wrapper}>
38+
<p className={styles.Text}>secondary</p>
39+
<Input variant="secondary" type="text" placeholder="가게명을 입력해주세요" />
40+
</div>
41+
</div>
42+
),
43+
};

0 commit comments

Comments
 (0)