Skip to content

Commit

Permalink
feat(ui) navigation 컴포넌트 제작
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene028 committed Jul 18, 2023
1 parent 1f963f4 commit 50e54d8
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/components/atoms/AppBar/AppBar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ const meta = {
argTypes: { onClickOption: {action: 'clicked'}},
decorators: [
(Story) => (
<>
<BrowserRouter>
<Routes>
<Route path="*" element={<Story/>}/>
</Routes>
</BrowserRouter>
</>
),
],
} satisfies Meta<typeof AppBar>;
Expand Down
11 changes: 8 additions & 3 deletions src/components/atoms/AppBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import { useNavigate } from "react-router-dom";

type AppBarType = 'logoWithAlarm' | 'backPush' | 'backPushWithMenu'

/**
* @param variant AppBar의 type을 나타냄 'logoWithAlarm' | 'backPush' | 'backPushWithMenu'
* @param label 'backPush' | 'backPushWithMenu' 사용 시 Appbar에 나타날 문구
* @param beforeUrl (optional) BackArrow를 통하여 이동할 url (기본값은 뒤로가기)
* @param onClickOption 두번째 버튼을 눌렀을 때 발생할 이벤트를 넘겨주는 함수
*/

interface AppBarProps {
variant : AppBarType;
label?: string;
Expand All @@ -25,9 +32,7 @@ export const AppBar = ({
}: AppBarProps) => {
const navigate = useNavigate();
const onClickBackBar = () => {
beforeUrl ? navigate(beforeUrl, {
state: { direction : 'navigate-pop'}
}) : navigate(-1)
beforeUrl ? navigate(beforeUrl) : navigate(-1)
}
const onClickLogo = () => {
navigate('/')
Expand Down
57 changes: 57 additions & 0 deletions src/components/atoms/Navigationbar/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import styled from "@emotion/styled"
import { theme } from "@styles/theme"
import { NavLink } from "react-router-dom"
import openEye from "../../../assets/icons/openEye.svg";

export const Navigationbar = () => {
return (
<Wrapper>
<NavBtn>
<img src={openEye}/>
</NavBtn>


<NavBtn>
<img src={openEye}/>
</NavBtn>


<NavBtn>
<img src={openEye}/>
</NavBtn>
<NavBorder/>
</Wrapper>
)
}

const Wrapper = styled.nav`
display: flex;
border-radius: 30px;
width: 200px;
height: 50px;
position: relative;
background-color: ${theme.palette.background};
border: 1px solid ${theme.palette.gray_800};
filter: drop-shadow(0px 2px 6px rgba(0, 0, 0, 0.12)) drop-shadow(0px 0px 2px rgba(0, 0, 0, 0.24));
`
const NavBtn = styled.button`
flex-grow: 1
z-index: 1;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
position : relative;
.active{
transform: translate3d(0, -.8em , 0);
}
`

const NavBorder = styled.div`
position: absolute;
background-color: ${theme.palette.background};
left:0;
bottom: 99%;
`
16 changes: 16 additions & 0 deletions src/components/atoms/Navigationbar/navigation.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Meta, StoryObj } from '@storybook/react';
import { BrowserRouter, Routes } from 'react-router-dom';
import { Navigationbar } from '.';

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

export default meta;
type Story = StoryObj<typeof meta>;

export const Navigation: Story = {

};

0 comments on commit 50e54d8

Please sign in to comment.