-
Notifications
You must be signed in to change notification settings - Fork 3
[Init] 글로벌 라우터 세팅 #17
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b99f2b0
feat: react-router 의존성 설치
jeonghoon11 552c955
Merge branch 'develop' of https://github.com/SOPT-all/37-COLLABORATIO…
jeonghoon11 7dc2c1a
feat: routePath 추가
jeonghoon11 7a2548a
feat: 페이지 lazy loading 적용
jeonghoon11 72e3049
chore: 필요없는 파일 삭제
jeonghoon11 4ebd8ac
feat: Router 적용
jeonghoon11 7e1beea
fix: 컨벤션에 따라 routePath -> ROUTE_PATH 수정
jeonghoon11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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,5 +1,19 @@ | ||
| import { router } from "@shared/router/router"; | ||
| import { RouterProvider } from "react-router"; | ||
|
|
||
| function App() { | ||
| return <div>티켓베이 파이팅~</div>; | ||
| return ( | ||
| // @TODO: global 테마 추가 | ||
| // <ThemeProvider> | ||
|
|
||
| // @TODO: 쿼리 클라이언트 추가 | ||
| // <QueryClientProvider client={queryClient}> | ||
| <RouterProvider router={router} /> | ||
| // <ReactQueryDevtools initialIsOpen={false} /> | ||
| // </QueryClientProvider> | ||
|
|
||
| // </ThemeProvider> | ||
| ); | ||
| } | ||
|
|
||
| export default App; |
This file contains hidden or 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,5 +1,9 @@ | ||
| import { useParams } from "react-router"; | ||
|
|
||
| const TicketDetail = () => { | ||
| return <div>TicketDetail</div>; | ||
| const { ticketId } = useParams(); | ||
|
|
||
| return <div>TicketDetail-{ticketId}</div>; | ||
| }; | ||
|
|
||
| export default TicketDetail; |
Empty file.
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { Suspense } from "react"; | ||
| import { Outlet, ScrollRestoration } from "react-router"; | ||
|
|
||
| export default function GlobalLayout() { | ||
| return ( | ||
| <> | ||
| <Suspense fallback={null}> | ||
| <Outlet /> | ||
| </Suspense> | ||
| <ScrollRestoration /> | ||
| </> | ||
| ); | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { lazy } from "react"; | ||
|
|
||
| export const HomePage = lazy(() => import("@pages/home/home")); | ||
|
|
||
| export const SelectTicketPage = lazy( | ||
| () => import("@pages/select-ticket/select-ticket") | ||
| ); | ||
| export const TicketDetailPage = lazy( | ||
| () => import("@pages/ticket-detail/ticket-detail") | ||
| ); |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| export const routePath = { | ||
| HOME: "/", | ||
| SELECT_TICKET: "/select-ticket", | ||
| TICKET_DETAIL: "/ticket-detail/:ticketId", | ||
| } as const; | ||
|
|
||
| export type Routes = (typeof routePath)[keyof typeof routePath]; | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { createBrowserRouter } from "react-router"; | ||
|
|
||
| import { globalRoutes } from "@shared/router/routes/global-routes"; | ||
| import GlobalLayout from "@shared/router/global-layout"; | ||
|
|
||
| export const router = createBrowserRouter([ | ||
| { | ||
| Component: GlobalLayout, | ||
| children: [...globalRoutes], | ||
| }, | ||
| ]); |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { | ||
| HomePage, | ||
| SelectTicketPage, | ||
| TicketDetailPage, | ||
| } from "@shared/router/lazy"; | ||
| import { routePath } from "@shared/router/path"; | ||
|
|
||
| export const globalRoutes = [ | ||
| { | ||
| path: routePath.HOME, | ||
| element: <HomePage />, | ||
| }, | ||
| { | ||
| path: routePath.SELECT_TICKET, | ||
| element: <SelectTicketPage />, | ||
| }, | ||
| { | ||
| path: routePath.TICKET_DETAIL, | ||
| element: <TicketDetailPage />, | ||
| }, | ||
| ]; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.