Skip to content

Commit

Permalink
feat: 휴지통 페이지, 네비게이션 UI 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
ShinjungOh committed Jul 20, 2024
1 parent a775a24 commit 2178bb4
Show file tree
Hide file tree
Showing 18 changed files with 325 additions and 108 deletions.
9 changes: 9 additions & 0 deletions src/assets/icon/drop_folder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions src/pages/home/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { Body } from '@/shared';
import { Nav } from '@/shared/components/Nav';

export const Home = () => (
<Body>
<h1>home</h1>
</Body>
<>
<Nav />
<Body>
<h1>home</h1>
</Body>
</>
);
2 changes: 2 additions & 0 deletions src/pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ export * from './Main';
export * from './auth/index';
export * from './home/index';
export * from './setting/index';
export * from './trash/index';
export * from './note/index';
8 changes: 8 additions & 0 deletions src/pages/note/NewNote.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Nav } from '@/shared';

export const NewNote = () => (
<>
<Nav />
<div>새 노트</div>
</>
);
5 changes: 5 additions & 0 deletions src/pages/note/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @file Automatically generated by barrelsby.
*/

export * from './NewNote';
27 changes: 3 additions & 24 deletions src/pages/setting/Setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,8 @@ import { useEffect, useState } from 'react';
import { Box, Flex } from '@chakra-ui/react';
import styled from '@emotion/styled';
import { useNavigate } from 'react-router-dom';
import {
BaseButton,
Body,
handleAxiosError,
http,
NavButton,
NavContent,
NavFooter,
Navigation,
PATH,
styleToken,
Typography,
} from '@/shared';
import { BaseButton, Body, handleAxiosError, http, PATH, styleToken, Typography } from '@/shared';
import { Nav } from '@/shared/components/Nav';

type User = {
id: number;
Expand All @@ -36,11 +25,6 @@ export const Setting = () => {
hasSubscribed: false,
});

const handleClickSetting = () => {
console.log('setting');
navigate(PATH.ACCOUNT);
};

const handleClickLogout = () => {
console.log('logout');
navigate(PATH.MAIN);
Expand All @@ -62,12 +46,7 @@ export const Setting = () => {

return (
<>
<Navigation>
<Typography variant="h2">Review with Ai</Typography>
<NavButton />
<NavContent />
<NavFooter onLogout={handleClickLogout} onSetting={handleClickSetting} />
</Navigation>
<Nav />
<Body>
<Container>
<Box
Expand Down
40 changes: 40 additions & 0 deletions src/pages/trash/Trash.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Box } from '@chakra-ui/react';
import styled from '@emotion/styled';
import { Body, styleToken, Typography } from '@/shared';
import { Nav } from '@/shared/components/Nav';

export const Trash = () => (
<>
<Nav />
<Body>
<Container>
<Box
style={{
padding: '29px 0 28px',
}}
>
<Typography variant="h1" fontWeight={400}>
휴지통
</Typography>
</Box>
<Box
style={{
margin: 0,
padding: '33px 0',
borderBottom: `1px solid ${styleToken.color.gray200}`,
}}
>
<Typography variant="subtitle1">휴지통에 저장된 항목은 1달이 지나면 자동으로 완전히 삭제됩니다.</Typography>
</Box>
</Container>
</Body>
</>
);

const Container = styled.div`
padding-right: 44px;
padding-left: 56px;
height: 100%;
width: 100%;
max-width: 1182px;
`;
5 changes: 5 additions & 0 deletions src/pages/trash/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @file Automatically generated by barrelsby.
*/

export * from './Trash';
4 changes: 3 additions & 1 deletion src/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AuthKakao, AuthNaver, Home, Login, Main, Signup, Setting } from '@/pages';
import { AuthKakao, AuthNaver, Home, Login, Main, Signup, Setting, Trash, NewNote } from '@/pages';
import { PATH, RouterLayout } from '@/shared';

export const routes = [
Expand All @@ -11,6 +11,8 @@ export const routes = [
{ path: PATH.OAUTH_KAKAO, element: <AuthKakao /> },
{ path: PATH.OAUTH_NAVER, element: <AuthNaver /> },
{ path: PATH.HOME, element: <Home /> },
{ path: PATH.NOTE, element: <NewNote /> },
{ path: PATH.TRASH, element: <Trash /> },
{ path: PATH.SETTING, element: <Setting /> },
{ path: PATH.ACCOUNT, element: <Setting /> },
],
Expand Down
58 changes: 58 additions & 0 deletions src/shared/components/Nav/Nav.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { Box } from '@chakra-ui/react';
import styled from '@emotion/styled';
import { useNavigate } from 'react-router-dom';
import { NavButton, NavContent, NavFooter, Navigation, PATH, Typography } from '@/shared';

export const Nav = () => {
const navigate = useNavigate();

const handleClickHome = () => {
console.log('home');
navigate(PATH.HOME);
};

const handleClickNewNote = () => {
console.log('new note');
navigate(PATH.NOTE);
};

const handleClickTrash = () => {
console.log('trash');
navigate(PATH.TRASH);
};

const handleClickSetting = () => {
console.log('setting');
navigate(PATH.ACCOUNT);
};

const handleClickLogout = () => {
console.log('logout');
navigate(PATH.MAIN);
};

return (
<Navigation>
<Container>
<Box
onClick={handleClickHome}
style={{
cursor: 'pointer',
}}
>
<Typography variant="h2">복습할고양</Typography>
</Box>
<NavButton onNote={handleClickNewNote} />
<NavContent onHome={handleClickHome} onTrash={handleClickTrash} />
<NavFooter onLogout={handleClickLogout} onSetting={handleClickSetting} />
</Container>
</Navigation>
);
};

const Container = styled.div`
display: flex;
flex-direction: column;
height: 100%;
flex: 1, 1;
`;
5 changes: 5 additions & 0 deletions src/shared/components/Nav/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @file Automatically generated by barrelsby.
*/

export * from './Nav';
56 changes: 39 additions & 17 deletions src/shared/components/NavButton/NavButton.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,43 @@
import { Flex } from '@chakra-ui/react';
import styled from '@emotion/styled';
import { styleToken } from '@/shared';

export const NavButton = () => (
<Flex width="100%" flexDirection="row" justifyContent="center" alignItems="center">
<Flex
width="56px"
height="56px"
flexDirection="row"
justifyContent="center"
alignItems="center"
style={{
border: `1px solid ${styleToken.color.gray300}`,
borderRadius: '50%',
cursor: 'pointer',
}}
>
<img src="/src/assets/note/add_memo.png" alt="새로운 노트 작성" width={30} height={30} />
</Flex>
</Flex>
type NavButtonProps = {
onNote: () => void;
};

export const NavButton = ({ onNote }: NavButtonProps) => (
<Container>
<Item>
<Flex
width="56px"
height="56px"
flexDirection="row"
justifyContent="center"
alignItems="center"
onClick={onNote}
style={{
border: `1px solid ${styleToken.color.gray300}`,
borderRadius: '50%',
cursor: 'pointer',
}}
>
<img src="/src/assets/note/add_memo.png" alt="새로운 노트 작성" width={25} height={25} />
</Flex>
</Item>
</Container>
);

const Container = styled.div`
width: 100%;
flex-basis: auto;
padding: 0;
margin: 19px 0 0 auto;
`;

const Item = styled(Flex)`
width: 100%;
flex-direction: row;
justify-content: center;
align-items: center;
`;
Loading

0 comments on commit 2178bb4

Please sign in to comment.