Skip to content

Commit

Permalink
Merge branch 'frontend' into #22-burgerK
Browse files Browse the repository at this point in the history
  • Loading branch information
burgerk98 authored Apr 19, 2024
2 parents 18c3484 + b5a61d1 commit 56bdf65
Show file tree
Hide file tree
Showing 15 changed files with 157 additions and 136 deletions.
1 change: 1 addition & 0 deletions frontend/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 33 additions & 1 deletion frontend/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
import { createBrowserRouter, RouterProvider } from 'react-router-dom'
import { ThemeProvider, createTheme } from '@mui/material/styles'
import { Container } from '@mui/material'

import _RootLayout from './components/layout/RootLayout'
import DetailPage from './pages/DetailPage'
import ErrorPage from './pages/ErrorPage'
import MainPage from './pages/MainPage'
import AuthPage from './pages/AuthPage'

const theme = createTheme({
palette: {
common: {
customWhite: '#ffffff',
customYellow: '#ffc145',
customRed: '#ff6b6c',
customPurple: '#b8b8d1',
customBlack: '#48495c',
customGray: '#a7a7a7',
},
},
})

const router = createBrowserRouter([
{
Expand All @@ -13,12 +29,28 @@ const router = createBrowserRouter([
children: [
{ index: true, element: <MainPage /> },
{ path: 'detail/:id', element: <DetailPage /> },
{ path: 'auth', element: <AuthPage /> },
],
},
])

function App() {
return <RouterProvider router={router} />
return (
<ThemeProvider theme={theme}>
<Container
maxWidth="md"
sx={{
fontSize: {
xs: theme.spacing(1.5), // 모바일
md: theme.spacing(1.7), // 태블릿
lg: theme.spacing(2), // 데스크톱
},
}}
>
<RouterProvider router={router} />
</Container>
</ThemeProvider>
)
}

export default App
1 change: 1 addition & 0 deletions frontend/src/assets/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
143 changes: 86 additions & 57 deletions frontend/src/components/layout/RootLayout/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { Link } from 'react-router-dom'
import useLoginStore from '@/store/login'
import { Button, Container } from '@mui/material'
import AppBar from '@mui/material/AppBar'
import Weather from './Weather'
import navLogo from '/images/nav_logo.png'
import Box from '@mui/material/Box'
import Toolbar from '@mui/material/Toolbar'
import Typography from '@mui/material/Typography'
import * as React from 'react'
import { Link } from 'react-router-dom'
import navLogo from '../../../../public/images/nav_logo.png'
import Weather from './Weather'
import Avatar from '@mui/material/Avatar'
import { Button, Container } from '@mui/material'
import { green } from '@mui/material/colors'

export const _Navbar = () => {
const { isLogined, setIsLogined } = useLoginStore((state) => state)
Expand Down Expand Up @@ -37,59 +36,89 @@ export const _Navbar = () => {
// }

return (
<Box sx={{ flexGrow: 1 }}>
<Container maxWidth="md" style={{ padding: 0 }}>
<AppBar
position="static"
style={{
backgroundColor: 'white',
boxShadow: 'none',
<Container maxWidth="md" style={{ padding: 0 }}>
<Box
component="div"
sx={{
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
mt: 2,
}}
>
<Box
component="div"
sx={{
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
gap: 2,
}}
>
<Toolbar>
<Link to={'/'}>
<img src={navLogo} alt="" />
<Link to={'/'}>
<img src={navLogo} alt="" />
</Link>
<Typography
color={'black'}
variant="h8"
component="div"
sx={{ flexGrow: 1 }}
>
<Weather />
</Typography>
</Box>
<Box>
{isLogined === false ? (
<Link to="/auth?mode=login">
<Button
style={{
backgroundColor: '#ffc145',
borderRadius: '16px',
}}
disableElevation
variant="contained"
size="medium"
// onClick={handleLoginModal}
>
로그인
</Button>
</Link>
<Typography
color={'black'}
variant="h6"
component="div"
sx={{ flexGrow: 1 }}
) : (
<Box
component="section"
sx={{
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
gap: 1,
}}
>
<Weather />
</Typography>
<div>
{isLogined === false ? (
<Button
style={{
backgroundColor: '#ffc145',
borderRadius: '16px',
}}
disableElevation
variant="contained"
size="medium"
onClick={handleLoginModal}
>
로그인
</Button>
) : (
<Button
style={{
backgroundColor: '#ffc145',
borderRadius: '50px',
}}
disableElevation
variant="contained"
size="medium"
onClick={handleLogoutUser}
>
로그아웃
</Button>
)}
</div>
</Toolbar>
</AppBar>
</Container>
</Box>
<Avatar
alt="Remy Sharp"
src="images/nav_logo.png"
sx={{
width: 36,
height: 36,
bgcolor: green[500],
}}
/>
<Button
style={{
backgroundColor: '#ffc145',
borderRadius: '50px',
}}
disableElevation
variant="contained"
size="medium"
onClick={handleLogoutUser}
>
로그아웃
</Button>
</Box>
)}
</Box>
</Box>
</Container>
)
}
31 changes: 0 additions & 31 deletions frontend/src/components/layout/RootLayout/RootLayout.css

This file was deleted.

5 changes: 5 additions & 0 deletions frontend/src/components/test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function test() {
return <div>test</div>;
}

export default test;
2 changes: 2 additions & 0 deletions frontend/src/index.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* {

margin: 0;
padding: 0;
box-sizing: border-box;
Expand All @@ -21,4 +22,5 @@

body {
font-family: 'SUIT Variable', sans-serif;

}
2 changes: 2 additions & 0 deletions frontend/src/main.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.jsx'
Expand Down Expand Up @@ -25,6 +26,7 @@ enableMocking().then(() => {
)
})


// https: ReactDOM.createRoot(document.getElementById("root")).render(
// <React.StrictMode>
// <App />
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/mocks/browser.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

import { setupWorker } from 'msw/browser'
import { handlers } from './handlers'

export const worker = setupWorker(...handlers)

2 changes: 2 additions & 0 deletions frontend/src/mocks/handlers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import { HttpResponse, http } from 'msw'
export const handlers = [
// By calling “http.get()” we’re instructing MSW
Expand All @@ -11,3 +12,4 @@ export const handlers = [
return HttpResponse.json({})
}),
]

7 changes: 7 additions & 0 deletions frontend/src/pages/AuthPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react'

function AuthPage() {
return <div>AuthPage</div>
}

export default AuthPage
2 changes: 2 additions & 0 deletions frontend/src/pages/DetailPage.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import { useParams } from 'react-router-dom'

function DetailPage() {
Expand All @@ -8,3 +9,4 @@ function DetailPage() {
}

export default DetailPage

Loading

0 comments on commit 56bdf65

Please sign in to comment.