Skip to content

Commit

Permalink
Merge pull request #101 from B03-Killer/feature/#100
Browse files Browse the repository at this point in the history
feat: TopBar 추가
  • Loading branch information
1eeyerin authored Aug 1, 2024
2 parents fdf7f46 + 52c7c2a commit 72061bf
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/components/TopBar/TopBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { useRouter } from 'next/navigation';
import Typography from '../Typography';
import { ArrowLeftIcon } from '@/icons';
import type { ComponentProps, ReactNode } from 'react';

export const BackButton = () => {
const router = useRouter();

return (
<button type="button" onClick={() => router.back()}>
<ArrowLeftIcon className="w-6 h-6" />
</button>
);
};

type TopBarProps = {
LeftIcon1?: ReactNode;
LeftIcon2?: ReactNode;
RightIcon1?: ReactNode;
RightIcon2?: ReactNode;
title: string;
} & ComponentProps<'header'>;

export const TopBar = ({ LeftIcon1, LeftIcon2, RightIcon1, RightIcon2, title, ...props }: TopBarProps) => {
return (
<header className="flex items-center justify-between h-[52px] px-4 gap-x-4 bg-white z-10" {...props}>
<div className="flex items-center gap-x-4 w-[62px]">
{LeftIcon1}
{LeftIcon2}
</div>
<Typography as="h1" variant="Title20px" color="grey900" className="flex-1 text-center">
{title}
</Typography>
<div className="flex items-center justify-end gap-x-4 w-[62px]">
{RightIcon2}
{RightIcon1}
</div>
</header>
);
};
1 change: 1 addition & 0 deletions src/components/TopBar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './TopBar';
1 change: 1 addition & 0 deletions src/icons/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as ArrowLeftIcon } from '@/icons/ArrowLeft.svg';

0 comments on commit 72061bf

Please sign in to comment.