-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from codesquad-team4-issue-tracker/fe
[team#04-FE] 2주차 PR
- Loading branch information
Showing
84 changed files
with
4,420 additions
and
1,300 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,57 @@ | ||
import { Routes, Route, useLocation } from 'react-router-dom'; | ||
import { css } from '@emotion/react'; | ||
import { useState } from 'react'; | ||
import { Theme, ThemeProvider, css } from '@emotion/react'; | ||
import { themes } from './styles/styles'; | ||
import Header from './components/Header/Header'; | ||
import SignIn from './components/Sign/SignIn'; | ||
import SignUp from './components/Sign/SignUp'; | ||
import IssueList from './components/Issue/IssueList/IssueList'; | ||
import IssueCreate from './components/Issue/IssueCreate/IssueCreate'; | ||
import IssueDetail from './components/Issue/IssueDetail/IssueDetail'; | ||
import Label from './components/Label/Label'; | ||
import Milestone from './components/Milestone/Milestone'; | ||
import LabelList from './components/Label/LabelList'; | ||
import MilestoneList from './components/Milestone/MilestoneList'; | ||
import ThemeToggle from './components/ThemeToggle'; | ||
|
||
export default function App() { | ||
const location = useLocation(); | ||
const hiddenHeaderRoutes = ['/', '/sign-in', '/sign-up']; | ||
const shouldShowHeader = !hiddenHeaderRoutes.includes(location.pathname); | ||
|
||
const [darkMode, setDarkMode] = useState(false); | ||
const theme = darkMode ? themes.dark : themes.light; | ||
|
||
const onThemeToggleClick = () => { | ||
setDarkMode((prevMode) => !prevMode); | ||
}; | ||
|
||
return ( | ||
<div | ||
css={css` | ||
display: flex; | ||
flex-direction: column; | ||
`} | ||
> | ||
{shouldShowHeader && <Header />} | ||
<Routes> | ||
<Route path="/" element={<SignIn />} /> | ||
<Route path="/sign-in" element={<SignIn />} /> | ||
<Route path="/sign-up" element={<SignUp />} /> | ||
<Route path="/issue" element={<IssueList />} /> | ||
<Route path="/issue/create" element={<IssueCreate />} /> | ||
<Route path="/issue/detail" element={<IssueDetail />} /> | ||
<Route path="/label" element={<Label />} /> | ||
<Route path="/milestone" element={<Milestone />} /> | ||
</Routes> | ||
</div> | ||
<ThemeProvider theme={theme}> | ||
<div css={body(theme)}> | ||
{shouldShowHeader && <Header />} | ||
<Routes> | ||
<Route path="/" element={<SignIn />} /> | ||
<Route path="/sign-in" element={<SignIn />} /> | ||
<Route path="/sign-up" element={<SignUp />} /> | ||
<Route path="/issue" element={<IssueList />} /> | ||
<Route path="/issue/create" element={<IssueCreate />} /> | ||
<Route path="/issue/detail" element={<IssueDetail />} /> | ||
<Route path="/label" element={<LabelList />} /> | ||
<Route path="/milestone" element={<MilestoneList />} /> | ||
</Routes> | ||
<ThemeToggle onClick={onThemeToggleClick} isDark={darkMode} /> | ||
</div> | ||
</ThemeProvider> | ||
); | ||
} | ||
|
||
const body = (theme: Theme) => css` | ||
display: flex; | ||
flex-direction: column; | ||
height: 100vh; | ||
background-color: ${theme.neutral.surfaceDefault}; | ||
& svg path { | ||
stroke: ${theme.neutral.textDefault}; | ||
} | ||
`; |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.