From 51cbf27993f440df0cb1b89480bece2db3340f20 Mon Sep 17 00:00:00 2001 From: yyeonzu <yyeonzuu@gmail.com> Date: Sun, 26 Jan 2025 17:52:55 +0900 Subject: [PATCH] =?UTF-8?q?:recycle:=20=EB=9D=BC=EC=9A=B0=ED=84=B0=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=EB=B3=80=EA=B2=BD=20(#249)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/Router.tsx | 56 +++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/src/router/Router.tsx b/src/router/Router.tsx index 28987bdc..5b926be1 100644 --- a/src/router/Router.tsx +++ b/src/router/Router.tsx @@ -1,14 +1,9 @@ -import React, { Suspense } from 'react'; -import { createBrowserRouter, Outlet } from 'react-router-dom'; +import React from 'react'; +import { createBrowserRouter } from 'react-router-dom'; import { ROUTE_PATH } from '@src/constants/routePath'; import { checkAuthLoader, isParamLoader } from '@src/router/loader'; -import Bottomsheet from '@src/components/common/Bottomsheet'; -import Dialog from '@src/components/common/Dialog'; -import CommunitySideBar from '@src/components/communitysidebar/CommunitySideBar'; -import RootErrorBoundary from '@src/components/errorBoundary/RootErrorBoundary'; -import ErrorCatcher from '@src/components/errorBoundary/ErrorCatcher'; -import LoadingPage from '@src/pages/fallback/LoadingPage'; -import QueryClientBoundary from '@src/components/queryClient/QueryClientBoundary'; +import { RootLayout } from '@src/router/RootLayout'; +import { BottomButtonLayout, NoDataTextLayout } from '@src/styles/Layout'; /* example */ const RouterExamplePage = React.lazy( @@ -102,24 +97,30 @@ const CommunityInfoSettingPage = React.lazy( const router = createBrowserRouter([ { - element: ( - <QueryClientBoundary> - <RootErrorBoundary> - <ErrorCatcher> - <Suspense fallback={<LoadingPage />}> - <Outlet /> - <Bottomsheet /> - <Dialog /> - <CommunitySideBar /> - </Suspense> - </ErrorCatcher> - </RootErrorBoundary> - </QueryClientBoundary> - ), - errorElement: <h1>Error</h1>, + element: <RootLayout />, loader: checkAuthLoader, children: [ - /* example */ + { + /* Button이 잇는 경우 Layout */ + element: <BottomButtonLayout />, + children: [ + { + path: ROUTE_PATH.createServer, + element: <CreateNewCommunityPage />, + }, + ], + }, + { + /* 데이터가 없는 경우 Layout */ + element: <NoDataTextLayout />, + children: [ + { + path: ROUTE_PATH.libraryBookSearch, + element: <SearchPage />, + }, + ], + }, + /* 이외의 경우 */ { path: ROUTE_PATH.example, element: <RouterExamplePage />, @@ -152,10 +153,7 @@ const router = createBrowserRouter([ element: <LibraryHomePage />, loader: (args) => isParamLoader(args, 'memberId'), }, - { - path: ROUTE_PATH.libraryBookSearch, - element: <SearchPage />, - }, + { path: ROUTE_PATH.libraryRecord, element: <RecordListPage />,