diff --git a/src/Components/Topbar/Tobar.stories.ts b/src/Components/Topbar/Tobar.stories.ts new file mode 100644 index 00000000..8970be50 --- /dev/null +++ b/src/Components/Topbar/Tobar.stories.ts @@ -0,0 +1,16 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import { TopBar } from '.'; + +const meta = { + component: TopBar, +} satisfies Meta; + +export default meta; + +type Story = StoryObj; + +export const Primary: Story = { + args: { + children: '스터디원이 남긴 나의 리뷰', + }, +} satisfies Story; diff --git a/src/Components/Topbar/index.tsx b/src/Components/Topbar/index.tsx new file mode 100644 index 00000000..97366900 --- /dev/null +++ b/src/Components/Topbar/index.tsx @@ -0,0 +1,61 @@ +import { useNavigate } from 'react-router-dom'; +import styled from 'styled-components'; + +export interface TopBarProps { + /** 왼쪽방향 아이콘과 제목 사이의 gap */ + gap?: number; + + /** Topbar Title content */ + children?: React.ReactNode; +} + +export const TopBar = ({ gap = 12, children }: TopBarProps) => { + const navigate = useNavigate(); + return ( + + navigate(-1)}> + + + + + {children} + + ); +}; + +const TopbarWrapper = styled.div<{ $gap?: number }>` + display: flex; + flex: 1 0 0; + max-width: 1224px; + width: 100%; + align-items: center; + gap: ${({ $gap }) => `${$gap}px`}; +`; + +const MoveBack = styled.button` + display: flex; + padding: 8px; + align-items: flex-end; + gap: 10px; + + &:hover { + cursor: pointer; + svg path { + fill-opacity: 0.85; + } + } +`; + +const TopBarContent = styled.p` + color: ${({ theme }) => theme.color.black5}; + font-family: 'Pretendard600'; + font-size: 18px; + font-style: normal; + font-weight: 600; + line-height: 32px; + flex: 1 0 0; +`; diff --git a/src/Mocks/browser.ts b/src/Mocks/browser.ts index 44f78f43..0a564278 100644 --- a/src/Mocks/browser.ts +++ b/src/Mocks/browser.ts @@ -1,4 +1,4 @@ -// import { setupWorker } from 'msw/browser'; -// import { handlers } from './handlers'; +import { setupWorker } from 'msw/browser'; +import { handlers } from './handlers'; -// export const worker = setupWorker(...handlers); +export const worker = setupWorker(...handlers);