Skip to content

Commit 0ba8ee7

Browse files
committed
feat: 앱 바 공통 컴포넌트 추가
1 parent c6b0709 commit 0ba8ee7

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Meta, StoryObj } from '@storybook/react';
2+
import AppBar from './AppBar';
3+
import { BrowserRouter } from 'react-router-dom';
4+
5+
const meta: Meta<typeof AppBar> = {
6+
title: 'AppBar',
7+
component: AppBar,
8+
render: (args) => (
9+
<BrowserRouter>
10+
<AppBar {...args} />
11+
</BrowserRouter>
12+
),
13+
};
14+
15+
export default meta;
16+
17+
export type story = StoryObj<typeof AppBar>;
18+
19+
export const Default: story = {
20+
args: {
21+
title: '모임 일정 등록하기',
22+
backButton: true,
23+
},
24+
};

src/components/common/AppBar.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { FC } from 'react';
2+
import HistoryBackButton from './HistoryBackButton';
3+
4+
interface AppBarProps {
5+
title?: string;
6+
backButton?: boolean;
7+
}
8+
9+
const AppBar: FC<AppBarProps> = ({ title = '', backButton = true }) => {
10+
return (
11+
<nav className="grid grid-cols-5 py-5">
12+
<div className="col-span-1">{backButton ? <HistoryBackButton /> : <span />}</div>
13+
<h1 className="col-span-3 text-center">{title}</h1>
14+
<span className="col-span-1" />
15+
</nav>
16+
);
17+
};
18+
19+
export default AppBar;

0 commit comments

Comments
 (0)