-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feat/#102]: 로그인,회원가입 수정 / 라우터 정리 / 서스펜스 적용
- Loading branch information
Showing
23 changed files
with
447 additions
and
404 deletions.
There are no files selected for viewing
This file contains 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,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 |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 { Outlet } from 'react-router-dom' | ||
|
||
const LayoutWithoutHeader = () => { | ||
return ( | ||
<div className="w-full flex justify-center"> | ||
<div className="w-full max-w-[1324px]"> | ||
<Outlet /> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default LayoutWithoutHeader |
This file contains 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
This file contains 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,17 +1,21 @@ | ||
import React from 'react' | ||
|
||
interface StartNavigatorProps { | ||
onClick: () => void | ||
text: string | ||
|
||
} | ||
|
||
export default function StartNavigator({ onClick }: StartNavigatorProps) { | ||
return ( | ||
<div className="fixed left-1/2 bottom-8 transform -translate-x-1/2 z-50"> | ||
<button | ||
onClick={onClick} | ||
className="w-80 h-16 rounded-full bg-opacity-80 bg-black flex items-center justify-center shadow-md drop-shadow-lg transform transition-transform transition-shadow duration-300 hover:scale-105 hover:shadow-2xl"> | ||
<div className="text-white text-3xl font-semibold" style={{ fontFamily: 'Noto Sans KR' }}> | ||
시작하기 | ||
</div> | ||
</button> | ||
</div> | ||
) | ||
} | ||
const StartNavigator: React.FC<StartNavigatorProps> = ({ onClick, text }) => ( | ||
<div className="fixed left-1/2 bottom-8 transform -translate-x-1/2 z-50"> | ||
<button | ||
onClick={onClick} | ||
className="w-80 h-16 rounded-full bg-opacity-80 bg-black flex items-center justify-center shadow-md drop-shadow-lg transform transition-transform transition-shadow duration-300 hover:scale-105 hover:shadow-2xl"> | ||
<div className="text-white text-3xl" style={{ fontFamily: 'Noto Sans KR' }}> | ||
{text} | ||
</div> | ||
</button> | ||
</div> | ||
) | ||
|
||
export default StartNavigator |
This file contains 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
This file contains 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
This file contains 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
This file contains 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,13 +1,27 @@ | ||
import ReactDOM from 'react-dom'; | ||
import App from './App'; | ||
import reportWebVitals from './reportWebVitals'; | ||
import "./index.css"; | ||
import 'tailwindcss/tailwind.css'; | ||
import { createRoot } from 'react-dom/client' | ||
import App from './App' | ||
import reportWebVitals from './reportWebVitals' | ||
import './index.css' | ||
import 'tailwindcss/tailwind.css' | ||
import { ClerkProvider } from '@clerk/clerk-react' | ||
|
||
ReactDOM.render( | ||
<App />, | ||
document.getElementById('root') | ||
); | ||
const PUBLISHABLE_KEY = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY | ||
|
||
if (!PUBLISHABLE_KEY) { | ||
throw new Error('Missing Clerk Publishable Key') | ||
} | ||
|
||
reportWebVitals(); | ||
const domNode = document.getElementById('root') | ||
if (!domNode) { | ||
throw new Error('Root element not found') | ||
} | ||
|
||
const root = createRoot(domNode) | ||
|
||
root.render( | ||
<ClerkProvider publishableKey={PUBLISHABLE_KEY} afterSignOutUrl="/"> | ||
<App /> | ||
</ClerkProvider>, | ||
) | ||
|
||
reportWebVitals() |
Oops, something went wrong.