Skip to content

Commit

Permalink
feat: Sidebar 스타일 및 이벤트 구현, router 개선
Browse files Browse the repository at this point in the history
  • Loading branch information
kumsil1006 committed Nov 24, 2022
1 parent 86682fd commit 4eac812
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 50 deletions.
19 changes: 11 additions & 8 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
import { ReactElement } from 'react';
import { RouterProvider } from 'react-router-dom';
import { router } from './Router';
import { BrowserRouter, Routes, Route } from 'react-router-dom';
import { Provider } from 'jotai';
import styled from 'styled-components';

import Header from './container/Header';
import Menubar from './container/Menubar';
import { Provider } from 'jotai';

const Wrapper = styled.div`
width: 100%;
`;

const App = (): ReactElement => {
return (
<>
<Provider>
<Provider>
<BrowserRouter>
<Menubar />
<Wrapper>
<Header />
<RouterProvider router={router} />
<Routes>
<Route path="/" element={<div>main</div>}></Route>
<Route path="/table" element={<div>table</div>}></Route>
</Routes>
</Wrapper>
</Provider>
</>
</BrowserRouter>
</Provider>
);
};

Expand Down
10 changes: 0 additions & 10 deletions client/src/Router.tsx

This file was deleted.

28 changes: 0 additions & 28 deletions client/src/components/LongLogo.tsx

This file was deleted.

12 changes: 10 additions & 2 deletions client/src/container/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { ReactElement } from 'react';
import styled from 'styled-components';

import Button from '../components/Button';
import Text from '../components/Text';
import LongLogo from '../components/LongLogo';
import LongLogo from '../images/LongLogo.svg';

import { useAtom } from 'jotai';
import { loginStateAtom } from '../util/GlobalState';
import { useNavigate } from 'react-router-dom';
// import { goHome } from '../util/Common';

const Wrapper = styled.div`
display: flex;
Expand All @@ -21,11 +25,15 @@ const FlexGrow3 = styled.div`

const Header = (): ReactElement => {
const [login, setUserLogin] = useAtom(loginStateAtom);
const navigate = useNavigate();

const goHome = (): void => {
navigate('/');
};
return (
<Wrapper>
<FlexGrow3>
<Button context={<LongLogo />} />
<Button context={<img src={LongLogo} />} onClick={goHome} />
</FlexGrow3>
{!login && (
<Button
Expand Down
26 changes: 25 additions & 1 deletion client/src/container/Menubar.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
import { ReactElement } from 'react';
import { useNavigate } from 'react-router-dom';
import styled from 'styled-components';

import Button from '../components/Button';

import Home from '../images/Home.svg';
import Table from '../images/Table.svg';

const Wrapper = styled.div`
height: 100vh;
background: #fcfcfc;
box-shadow: 2px 0px 4px rgba(0, 0, 0, 0.25);
text-align: center;
`;

const Menubar = (): ReactElement => {
return <Wrapper>menu</Wrapper>;
const navigate = useNavigate();

const goHome = (): void => {
navigate('/');
};

const goTable = (): void => {
navigate('/table');
};

return (
<Wrapper>
<Button context={<img src={Home} />} margin={'30px 0 0 0'} onClick={goHome} />
<Button context={<img src={Table} />} margin={'30px 0 0 0'} onClick={goTable} />
</Wrapper>
);
};

export default Menubar;
6 changes: 6 additions & 0 deletions client/src/images/Home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4eac812

Please sign in to comment.