-
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.
- Loading branch information
Showing
10 changed files
with
111 additions
and
16 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
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,30 @@ | ||
import { Suspense } from 'react'; | ||
import { | ||
Route, | ||
createBrowserRouter, | ||
createRoutesFromElements, | ||
} from 'react-router-dom'; | ||
|
||
import LayoutContainer from '../shared/layout/Container'; | ||
import HomeContainer from '../home/Container'; | ||
import LoginContainer from '../login/Container'; | ||
import ErrorContainer from '../shared/error/Container'; | ||
import NotFound from '../shared/error/notfound/NotFound'; | ||
|
||
const router = createRoutesFromElements( | ||
<Route | ||
path="/" | ||
element={ | ||
<Suspense> | ||
<LayoutContainer /> | ||
</Suspense> | ||
} | ||
errorElement={<ErrorContainer />} | ||
> | ||
<Route index element={<HomeContainer />} /> | ||
<Route path="login" element={<LoginContainer />} /> | ||
<Route path="*" element={<NotFound />} /> | ||
</Route>, | ||
); | ||
|
||
export default createBrowserRouter(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum URL { | ||
home = '/', | ||
login = '/login', | ||
} |
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,7 @@ | ||
import { FunctionComponent } from 'react'; | ||
|
||
const ErrorContainer: FunctionComponent = () => { | ||
return <div>Error!</div>; | ||
}; | ||
|
||
export default ErrorContainer; |
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,19 @@ | ||
import { FunctionComponent } from 'react'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { URL } from '../../constants/url'; | ||
import './notfound.scss'; | ||
|
||
const NotFound: FunctionComponent = () => { | ||
const navigate = useNavigate(); | ||
const handleHomeClick = () => navigate(URL.home); | ||
|
||
return ( | ||
<div className="not-found"> | ||
<span>404</span> | ||
<button onClick={handleHomeClick}>Go Home</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default NotFound; |
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,17 @@ | ||
.not-found { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
height: 100vh; | ||
|
||
span { | ||
font-size: 3rem; | ||
font-weight: 600; | ||
} | ||
|
||
button { | ||
border: none; | ||
cursor: pointer; | ||
} | ||
} |
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,16 @@ | ||
import { FunctionComponent, PropsWithChildren } from 'react'; | ||
import { FunctionComponent } from 'react'; | ||
import { Outlet } from 'react-router-dom'; | ||
|
||
import './layout.scss'; | ||
import useLayout from './hooks/useLayout'; | ||
|
||
const LayoutContainer: FunctionComponent<PropsWithChildren> = ({ | ||
children, | ||
}) => { | ||
const LayoutContainer: FunctionComponent = () => { | ||
useLayout(); | ||
return <div className="layout-container">{children}</div>; | ||
return ( | ||
<div className="layout-container"> | ||
<Outlet /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LayoutContainer; |
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