-
-
Save laurisstepanovs/b5b4a5d9bf458d01d31afc319f97ba79 to your computer and use it in GitHub Desktop.
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
| /* eslint-disable jsx-a11y/anchor-is-valid */ | |
| import {Route, Routes, Outlet} from 'react-router-dom' | |
| import {Error500} from './components/Error500' | |
| import {Error404} from './components/Error404' | |
| import {useEffect} from 'react' | |
| import {toAbsoluteUrl} from '../../../_metronic/helpers' | |
| import {useThemeMode} from "../../../_metronic/partials/layout/theme-mode/ThemeModeProvider"; | |
| const BODY_CLASSES = ['bgi-size-cover', 'bgi-position-center', 'bgi-no-repeat'] | |
| const ErrorsLayout = () => { | |
| const {mode} = useThemeMode() | |
| useEffect(() => { | |
| BODY_CLASSES.forEach((c) => document.body.classList.add(c)) | |
| document.body.style.backgroundImage = | |
| mode === 'dark' | |
| ? `url(${toAbsoluteUrl('/media/auth/bg7-dark.jpg')})` | |
| : `url(${toAbsoluteUrl('/media/auth/bg7.jpg')})` | |
| return () => { | |
| BODY_CLASSES.forEach((c) => document.body.classList.remove(c)) | |
| document.body.style.backgroundImage = 'none' | |
| } | |
| }, [mode]) | |
| return ( | |
| <div className='d-flex flex-column flex-root'> | |
| <div className='d-flex flex-column flex-center flex-column-fluid'> | |
| <div className='d-flex flex-column flex-center text-center p-10'> | |
| <div className='card card-flush w-lg-650px py-5'> | |
| <div className='card-body py-15 py-lg-20'> | |
| <Outlet /> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| ) | |
| } | |
| const ErrorsPage = () => ( | |
| <Routes> | |
| <Route element={<ErrorsLayout />}> | |
| <Route path='404' element={<Error404 />} /> | |
| <Route path='500' element={<Error500 />} /> | |
| <Route index element={<Error404 />} /> | |
| </Route> | |
| </Routes> | |
| ) | |
| export {ErrorsPage} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment