Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1e377eb
Merge branch 'develop' of https://github.com/Team-3-2/Wine into develop
huuitae Sep 25, 2025
260c7c1
Merge branch 'develop' of https://github.com/Team-3-2/Wine into develop
huuitae Sep 25, 2025
7165c61
design: text input 컴포넌트 제작
huuitae Sep 25, 2025
fe5c030
design: 와인 타입 선택 컴포넌트 제작
huuitae Sep 25, 2025
ef99fc3
design: 와인 타입 선택 컴포넌트 제작
huuitae Sep 26, 2025
c207fb1
refactor: 와인 타입 컴포넌트 이벤트 핸들러 props 수정
huuitae Sep 26, 2025
f21293f
design: 타입 선택 이름 수정
huuitae Sep 26, 2025
8786a2e
Merge branch 'develop' of https://github.com/Team-3-2/Wine into develop
huuitae Sep 26, 2025
c00c950
design: text input 컴포넌트 제작
huuitae Sep 25, 2025
e1a55ac
design: 와인 타입 선택 컴포넌트 제작
huuitae Sep 25, 2025
e9efd5e
design: 와인 타입 선택 컴포넌트 제작
huuitae Sep 26, 2025
fcafba3
refactor: 와인 타입 컴포넌트 이벤트 핸들러 props 수정
huuitae Sep 26, 2025
fe9465b
design: 타입 선택 이름 수정
huuitae Sep 26, 2025
d4bfb45
Merge branch 'design/type-select' of https://github.com/Team-3-2/Wine…
huuitae Sep 26, 2025
ca040aa
style: 코드 리뷰 내용 반영
huuitae Sep 26, 2025
9f9981e
Merge branch 'develop' of https://github.com/Team-3-2/Wine into develop
huuitae Sep 26, 2025
eec6a79
design: text input 컴포넌트 제작
huuitae Sep 25, 2025
c8848c0
design: 와인 타입 선택 컴포넌트 제작
huuitae Sep 25, 2025
f3aee94
design: 와인 타입 선택 컴포넌트 제작
huuitae Sep 26, 2025
d3d0624
refactor: 와인 타입 컴포넌트 이벤트 핸들러 props 수정
huuitae Sep 26, 2025
84a5937
design: 타입 선택 이름 수정
huuitae Sep 26, 2025
4984bd1
design: text input 컴포넌트 제작
huuitae Sep 25, 2025
1c36fd1
design: 와인 타입 선택 컴포넌트 제작
huuitae Sep 25, 2025
0e6ed13
style: 코드 리뷰 내용 반영
huuitae Sep 26, 2025
15286e3
Merge branch 'design/type-select' of https://github.com/Team-3-2/Wine…
huuitae Sep 26, 2025
647f82c
chore: 변경된 색상 코드에 맞게 수정
huuitae Sep 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/images/wine-type/red.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/wine-type/sparkling.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/wine-type/white.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/app/example/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SelectType } from "@/components";
import Header from "@/components/header/Header";
import React from "react";

Expand All @@ -10,6 +11,12 @@ const Page = () => {
description="Western Cape, South Africa"
price="64,990"
/>

<section>
<SelectType isError={false} />
<br />
<SelectType isError={true} />
</section>
</div>
);
};
Expand Down
2 changes: 2 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export { default as Gnb } from "./gnb/Gnb";
export { default as Header } from "./header/Header";
export { TextInput, ModalTextInput } from "./text-input/text-input";
export { default as SelectType } from "./select-type/select-type";
25 changes: 25 additions & 0 deletions src/components/select-type/select-type.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Meta, StoryObj } from "@storybook/nextjs";
import SelectType from "./select-type";

const meta: Meta<typeof SelectType> = {
title: "Components/type-select",
component: SelectType,
parameters: {
layout: "centered",
},
argTypes: {},
};

export default meta;

type Story = StoryObj<typeof SelectType>;

export const WineTypeSelect: Story = {
args: {},
};

export const WineTypeSelectError: Story = {
args: {
isError: true,
},
};
81 changes: 81 additions & 0 deletions src/components/select-type/select-type.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { cn } from "@/lib/utils";
import Image from "next/image";
import redWine from "../../../public/images/wine-type/red.jpg";
import whiteWine from "../../../public/images/wine-type/white.jpg";
import sparklingWine from "../../../public/images/wine-type/sparkling.jpg";

const imgMap = {
Red: redWine,
White: whiteWine,
Sparkling: sparklingWine,
} as const;

type WineType = keyof typeof imgMap;

const TypeInput = ({ name }: { name: WineType }) => {
const imgSrc = imgMap[name] || "";

return (
<div
className={cn(
"h-[38px]",
"rounded-full border border-border-secondary",
"flex items-center",
"bg-white",
"pc:h-[48px]"
)}
>
<input
type="radio"
id={name}
value={name}
name="wine-type"
className="peer hidden"
/>
<label
htmlFor={name}
className={cn(
"py-[7px] pl-2 pr-3",
"flex items-center justify-center gap-[6px]",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"flex items-center justify-center" -> "flex-center" 으로 변경해도 좋을 것 같아요!

"cursor-pointer rounded-full",
"text-default hover:bg-gray100",
"peer peer-checked:bg-gray800 peer-checked:text-white"
)}
>
<Image
className={cn("h-6 rounded-full object-cover", "pc:h-8 pc:w-8")}
src={imgSrc}
width={24}
height={24}
alt="레드와인"
draggable={false}
/>
<span className="text-body-sm tracking-[-0.02em] pc:text-body-md">
{name}
</span>
</label>
</div>
);
};

const SelectType = ({ isError }: { isError: boolean }) => {
return (
<div className="flex flex-col gap-2">
<div className="flex items-center gap-2">
<p className="text-body-sm tracking-[-0.02em] text-default">타입</p>
{isError && (
<p className="text-component-notes-md tracking-[-0.02em] text-danger">
와인 타입은 필수 입력이에요
</p>
)}
</div>
<div className="flex gap-[10px]">
<TypeInput name="Red" />
<TypeInput name="White" />
<TypeInput name="Sparkling" />
</div>
</div>
);
};

export default SelectType;
49 changes: 49 additions & 0 deletions src/components/text-input/text-input.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { Meta, StoryObj } from "@storybook/nextjs";
import { ModalTextInput, TextInput } from "./text-input";

const meta: Meta<typeof TextInput> = {
title: "Components/text-input",
component: TextInput,
parameters: {
layout: "centered",
},
argTypes: {
title: { control: { type: "text" } },
placeholder: { control: { type: "text" } },
},
};

export default meta;

type Story = StoryObj<typeof TextInput>;

export const NoContent: Story = {
args: {
title: "",
placeholder: "",
},
};

export const InputError: Story = {
args: {
title: "",
placeholder: "",
errorMsg: "에러가 발생했습니다",
},
};

export const LongText: Story = {
args: {
title:
"여긴 긴 제목이 들어가는 곳 입니다. 여긴 긴 제목이 들어가는 곳 입니다. 여긴 긴 제목이 들어가는 곳 입니다.",
placeholder:
"긴 placeholder를 입력해주세요 긴 placeholder를 입력해주세요 긴 placeholder를 입력해주세요",
},
};

export const ModalInputError: Story = {
render: (args) => <ModalTextInput {...args} />,
args: {
errorMsg: "에러가 발생했습니다",
},
};
83 changes: 83 additions & 0 deletions src/components/text-input/text-input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { cn } from "@/lib/utils";

interface InputValue {
placeholder: string;
errorMsg: string;
}

interface TextInputValue extends InputValue {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interface InputValue {
 placeholder: string;
 errorMsg: string;
 title?: string;
}

두 인터페이스를 합쳐서 title 값만 옵셔널로 지정하는건 어떤가요?

title: string;
}

/**
* 기본 Input
* @param placeholder input의 placeholder
* @param errorMsg 표출할 에러 메시지
* @returns
*/
const Input = ({ placeholder, errorMsg }: InputValue) => {
{
/* TODO(휘태): 에러 아이콘 넣기 */
}
return (
<input
id="text-input"
className={cn(
"w-[303px]",
"px-4 py-3",
"rounded border border-gray-300",
"text-[14px] leading-5 tracking-[0.02em] text-default",
"placeholder:text-body-sm placeholder:font-normal placeholder:text-tertiary",
"focus:outline-none",
"pc:w-[400px] pc:text-[16px] pc:leading-6 pc:placeholder:text-body-md pc:placeholder:font-normal",
errorMsg && "border-2 border-danger"
)}
type="text"
placeholder={placeholder ? placeholder : "내용을 입력해주세요"}
/>
);
};

/**
* 기본 입력 창
* @param title 제목
* @param placeholder input의 placeholder
* @param errorMsg 표출할 에러 메시지
* @returns input
*/
const TextInput = ({ title, placeholder, errorMsg }: TextInputValue) => {
return (
<>
<div className={cn("flex flex-col gap-2")}>
<p className={"text-body-sm font-bold tracking-[0.02em] text-gray-800"}>
{title ? title : "제목"}
</p>
<Input placeholder={placeholder} errorMsg={errorMsg} />
</div>
{errorMsg && <p className="mt-1 text-body-sm text-danger">{errorMsg}</p>}
</>
);
};

/**
* 모달 창에서 사용할 입력 창
* @param title
* @param placeholder
* @param errorMsg
* @returns modal input
*/
const ModalTextInput = ({ title, placeholder, errorMsg }: TextInputValue) => {
return (
<div className={cn("flex flex-col gap-2")}>
<div className="flex gap-2">
<p className={"text-body-sm font-bold tracking-[0.02em] text-gray-800"}>
{title ? title : "제목"}
</p>
{errorMsg && <p className="text-body-sm text-danger">{errorMsg}</p>}
</div>
<Input placeholder={placeholder} errorMsg={errorMsg} />
</div>
);
};

export { TextInput, ModalTextInput };
5 changes: 5 additions & 0 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export default {
gray600: "#8C8C8B",
gray800: "#484746",
primary: "#1A1918",
danger: "#ff6b6b",
border: {
secondary: "#F2F2F2",
tertiary: "#BABABA",
},
},
screens: {
mobile: { max: "743px" },
Expand Down