Skip to content

Commit

Permalink
[#357] TopHeader UI 컴포넌트 및 스토리북 작성 (#379)
Browse files Browse the repository at this point in the history
* feat: TopHeader UI 컴포넌트 및 스토리북 작성

* fix: css padding 설정 및 팀 컨벤션에 맞춰 코드 수정

* fix: TopHeader 컴포넌트 패딩 값 재설정

* fix: TopHeader 메뉴 아이콘 크기 재설정

* fix: 아이콘 svgr 변경 및 사이즈 변경 & prettierrc파일 확장자 json으로 변경

* fix: 아이콘 크기 변경
  • Loading branch information
WooDaeHyun authored and gxxrxn committed Jun 17, 2024
1 parent 41f8f99 commit 4dfbcc8
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 1 deletion.
File renamed without changes.
1 change: 1 addition & 0 deletions public/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export { default as IconLeftArrow } from './left-arrow.svg';
export { default as IconShare } from './share.svg';
export { default as IconPost } from './post.svg';
export { default as IconOptions } from './options.svg';
export { default as IconMore } from './more.svg';
2 changes: 1 addition & 1 deletion public/icons/more.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions src/stories/Base/TopHeader.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Meta, StoryObj } from '@storybook/react';
import { IconMore } from '@public/icons';
import TopHeader from '@/ui/Base/TopHeader';

const meta: Meta<typeof TopHeader> = {
title: 'Base/TopHeader',
component: TopHeader,
tags: ['autodocs'],
};

export default meta;

type Story = StoryObj<typeof TopHeader>;

const TopHeaderWithMenu = () => {
return (
<TopHeader label="Profile">
<button
onClick={() => {
alert('HAMBURGUR MENU!🍔');
}}
>
<IconMore width={20} height={20} alt="햄버거메뉴" />
</button>
</TopHeader>
);
};

export const Default: Story = {
args: { label: 'BookArchive' },
};

export const Menu: Story = {
render: () => <TopHeaderWithMenu />,
};
17 changes: 17 additions & 0 deletions src/ui/Base/TopHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ReactNode } from 'react';

interface TopHeaderProps {
label: string;
children?: ReactNode;
}

const TopHeader = ({ label, children }: TopHeaderProps) => {
return (
<div className="flex items-center justify-between px-[2rem] pb-[0.8rem] pt-[2rem]">
<p className="text-xl font-bold text-main-900">{label}</p>
{children}
</div>
);
};

export default TopHeader;

0 comments on commit 4dfbcc8

Please sign in to comment.