-
Notifications
You must be signed in to change notification settings - Fork 0
/
Router.tsx
73 lines (70 loc) · 2.23 KB
/
Router.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { createBrowserRouter } from 'react-router-dom'
import { lazy, Suspense } from 'react'
import { ClipLoader } from 'react-spinners'
import Layout from './src/components/Layout'
import LayoutWithoutHeader from './src/components/LayoutWithoutHeader' // 새로운 레이아웃
const MainPage = lazy(() => import('./src/pages/MainPage'))
const LoginPage = lazy(() => import('./src/pages/LoginPage'))
const SignUpPage = lazy(() => import('./src/pages/SignUpPage'))
const MyPage = lazy(() => import('./src/pages/MyPage'))
const SearchPage = lazy(() => import('./src/pages/SearchPage'))
const BookInfoPage = lazy(() => import('./src/pages/BookInfoPage'))
const ChoosePage = lazy(() => import('./src/pages/ChoosePage'))
const Statistics = lazy(() => import('./src/pages/Statistics'))
const BookStackPage = lazy(() => import('./src/pages/BookStackPage'))
const router = createBrowserRouter([
{
path: '/',
element: (
<Suspense
fallback={
<div
style={{
width: '100%',
height: '67.5rem',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}}>
<ClipLoader color="black" size={28} />
</div>
}>
<LayoutWithoutHeader />
</Suspense>
),
children: [
{ path: '/', element: <MainPage /> },
{ path: '/login', element: <LoginPage /> },
{ path: '/signup', element: <SignUpPage /> },
],
},
{
path: '/',
element: (
<Suspense
fallback={
<div
style={{
width: '100%',
height: '67.5rem',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}}>
<ClipLoader color="black" size={28} />
</div>
}>
<Layout />
</Suspense>
),
children: [
{ path: '/mypage', element: <MyPage /> },
{ path: '/booksearch', element: <SearchPage /> },
{ path: '/book/:id', element: <BookInfoPage /> },
{ path: '/choose', element: <ChoosePage /> },
{ path: '/activity', element: <Statistics /> },
{ path: '/stack', element: <BookStackPage /> },
],
},
])
export default router