Skip to content

Commit

Permalink
Merge pull request #8 from Dev-FE-1/feat/router-#3
Browse files Browse the repository at this point in the history
Feat/router #3 라우터 초기설정
  • Loading branch information
sjgaru-dev authored Aug 24, 2024
2 parents 047e7cd + adde1a7 commit 666fffb
Show file tree
Hide file tree
Showing 15 changed files with 150 additions and 23 deletions.
12 changes: 9 additions & 3 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,27 @@ module.exports = {
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
ecmaVersion: 'latest',
sourceType: 'module',
},
parser: '@typescript-eslint/parser',
plugins: ['react', 'prettier', '@typescript-eslint', 'jsx-a11y', '@emotion'],
rules: {
'prettier/prettier': 'error',
'prettier/prettier': ['error', { endOfLine: 'auto' }],
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'no-console': 'warn',
'no-unused-vars': 'warn',
'prettier/prettier': ['error', { endOfLine: 'auto' }],
'no-console': ['warn', { allow: ['warn', 'error'] }],
},
settings: {
react: {
version: 'detect',
},
},
}
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<!doctype html>
<html lang="en">
<html lang="ko">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<title>My Idoru</title>
</head>
<body>
<div id="root"></div>
Expand Down
42 changes: 42 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@tanstack/react-query": "^5.51.24",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.26.1",
"zustand": "^4.5.5"
},
"devDependencies": {
Expand Down
48 changes: 34 additions & 14 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,37 @@
import { css } from '@emotion/react'
import './App.css'
import { createBrowserRouter, RouterProvider } from 'react-router-dom'

function App() {
const papagraphStyles = css`
font-weight: bold;
font-size: 64px;
text-decoration: underline;
`
return (
<>
<p css={papagraphStyles}>Don't be late!!</p>
</>
)
}
import CreatePlaylist from './pages/CreatePlaylist'
import EditProfile from './pages/EditProfile'
import Follow from './pages/Follow'
import Login from './pages/Login'
import Home from './pages/Home'
import Page404 from './pages/Page404'
import Playlist from './pages/Playlist'
import Profile from './pages/Profile'
import Search from './pages/Search'

const router = createBrowserRouter([
{
path: '/',
element: <Home />,
errorElement: <Page404 />,
children: [
{ path: '/login', element: <Login /> },
{ path: '/search', element: <Search /> },
{ path: '/playlist', element: <Playlist /> },
{ path: '/createplaylist', element: <CreatePlaylist /> },
{
path: '/profile',
element: <Profile />,
children: [
{ path: 'editprofile', element: <EditProfile /> },
{ path: 'follow', element: <Follow /> },
],
},
],
},
])

const App = () => <RouterProvider router={router} />

export default App
4 changes: 0 additions & 4 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
-moz-osx-font-smoothing: grayscale;
}

test {
font-size: 0;
}

a {
font-weight: 500;
color: #646cff;
Expand Down
5 changes: 5 additions & 0 deletions src/pages/CreatePlaylist.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const CreatePlaylist = () => {
return <div>CreatePlaylist</div>
}

export default CreatePlaylist
5 changes: 5 additions & 0 deletions src/pages/EditProfile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const EditProfile = () => {
return <div>EditProfile</div>
}

export default EditProfile
5 changes: 5 additions & 0 deletions src/pages/Follow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Follow = () => {
return <div>Follow</div>
}

export default Follow
12 changes: 12 additions & 0 deletions src/pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Outlet } from 'react-router-dom'

const Home = () => {
return (
<div>
<h1>Home</h1>
<Outlet />
</div>
)
}

export default Home
5 changes: 5 additions & 0 deletions src/pages/Login.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Login = () => {
return <div>Login</div>
}

export default Login
15 changes: 15 additions & 0 deletions src/pages/Page404.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import styled from '@emotion/styled'

const Page404 = () => {
return <StyledContainer>404</StyledContainer>
}

export default Page404

const StyledContainer = styled.div`
font-size: 3rem;
display: flex;
justify-content: center;
align-items: center;
width: 100vw;
`
5 changes: 5 additions & 0 deletions src/pages/Playlist.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Playlist = () => {
return <div>Playlist</div>
}

export default Playlist
5 changes: 5 additions & 0 deletions src/pages/Profile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Profile = () => {
return <div>Profile</div>
}

export default Profile
5 changes: 5 additions & 0 deletions src/pages/Search.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Search = () => {
return <div>Search</div>
}

export default Search

0 comments on commit 666fffb

Please sign in to comment.