Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions src/app/example/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
TextInput,
} from "@/components";
import Profile from "@/components/profile/profile";
import Searchbar from "@/components/searchbar/searchbar";
import WineImg from "@/components/wine-img/wine-img";
import React, { ChangeEvent } from "react";

Expand Down Expand Up @@ -110,6 +111,10 @@ const Page = () => {
<WineImg isError={true} errorMsg="와인 사진은 필수" />
</section>

<section>
<Searchbar onChange={handleChange} />
</section>

<br />
</div>
);
Expand Down
35 changes: 35 additions & 0 deletions src/components/searchbar/searchbar.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Meta, StoryObj } from "@storybook/nextjs";
import Searchbar from "./searchbar";

const meta: Meta<typeof Searchbar> = {
title: "Components/Searchbar",
component: Searchbar,
parameters: {
layout: "centered",
docs: {
description: {
component: "검색창 컴포넌트 입니다.",
},
},
},
tags: ["autodocs"],
argTypes: {},
};

export default meta;

type Story = StoryObj<typeof Searchbar>;

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

export const ListSearchbar: Story = {
render: () => {
return (
<div className="w-[800px]">
<Searchbar />
</div>
);
},
};
36 changes: 36 additions & 0 deletions src/components/searchbar/searchbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { cn } from "@/lib/utils";
import Icon from "../icon/icon";
import { ComponentProps } from "react";

/**
* 검색바 컴포넌트
* @author hwitae
*/
const Searchbar = ({ ...props }: ComponentProps<"input">) => {
return (
<label
htmlFor="searchbar"
className={cn(
"px-[14px] py-[9px]",
"flex items-center gap-2",
"rounded-[4px] border border-gray-300",
"pc:px-[20px] pc:py-[12px]"
)}
>
<Icon icon="SearchIcon" size={"sm"} className="shrink-0 text-gray-900" />
<input
id="searchbar"
type="text"
placeholder="와인을 검색해 보세요"
className={cn(
"h-5 min-w-0 flex-1 text-body-sm font-semibold tracking-[-0.02em] text-gray-900",
"placeholder:font-normal placeholder:text-gray-400",
"focus:font-normal focus:outline-none"
)}
{...props}
/>
</label>
);
};

export default Searchbar;