Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature/#13/router] - 헤더 레이아웃 #22

Merged
merged 3 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 165 additions & 24 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 @@ -30,6 +30,7 @@
"react-dom": "^18.2.0",
"react-icons": "^5.0.1",
"react-router-dom": "^6.22.0",
"rollup": "^4.10.0",
"styled-components": "^6.1.8",
"zustand": "^4.5.0"
},
Expand Down
31 changes: 9 additions & 22 deletions src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { Outlet, createBrowserRouter } from "react-router-dom"

import TestPage from "@/pages/TestPage/TestPage"
import { createBrowserRouter } from "react-router-dom"

import ErrorPage from "@pages/ErrorPage/ErrorPage"
import HomePage from "@pages/HomePage/HomePage"
Expand All @@ -10,15 +8,13 @@ import ProjectDetailPage from "@pages/ProjectDetailPage/ProjectDetailPage"
import ProjectEditPage from "@pages/ProjectEditPage/ProjectEditPage"
import ProjectListPage from "@pages/ProjectListPage/ProjectListPage"
import SignUpPage from "@pages/SignUpPage/SignUpPage"
import TestPage from "@pages/TestPage/TestPage"

import DefaultLayout from "@styles/layouts/DefaultLayout"

export const router = createBrowserRouter([
{
element: (
<>
{/* <Header /> */}
<Outlet />
</>
),
element: <DefaultLayout />,
errorElement: <ErrorPage />,
children: [
{
Expand All @@ -40,25 +36,16 @@ export const router = createBrowserRouter([
},
],
},
{
path: "/login",
element: <LoginPage />,
},
{
path: "/signup",
element: <SignUpPage />,
},
{
path: "/test",
element: <TestPage />,
},
{
path: "/profile/:userId",
element: <ProfilePage />,
},
],
},

{
path: "/profile/:userId",
element: <ProfilePage />,
},
{
path: "/login",
element: <LoginPage />,
Expand Down
14 changes: 14 additions & 0 deletions src/styles/layouts/DefaultLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Outlet } from "react-router"

import Header from "@components/Header/Header"

const DefaultLayout = () => {
return (
<>
<Header />
<Outlet />
</>
)
}

export default DefaultLayout
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"forceConsistentCasingInFileNames": false,
"baseUrl": ".",
"paths": {
"@/*": ["src/*"],
"@components/*": ["src/components/*"],
"@apis/*": ["src/apis/*"],
"@assets/*": ["src/assets/*"],
Expand All @@ -33,7 +32,8 @@
"@constants/*": ["src/constants/*"],
"@styles/*": ["src/styles/*"],
"@types/*": ["src/types/*"],
"@utils/*": ["src/utils/*"]
"@utils/*": ["src/utils/*"],
"@/*": ["src/*"]
}
},

Expand Down
Loading