55 lines
1.5 KiB
TypeScript
Raw Normal View History

import { Link, useLocation, useRouteError } from 'react-router-dom'
2024-10-23 17:52:53 +02:00
import { appRoutes } from 'routes'
2024-11-12 14:22:54 +01:00
interface NotFoundPageProps {
title: string
message: string
}
export const NotFoundPage = ({
title = 'Page not found',
message = "The page you're attempting to visit doesn't exist"
}: Partial<NotFoundPageProps>) => {
const error = useRouteError() as Partial<NotFoundPageProps>
const location = useLocation()
2024-10-23 17:52:53 +02:00
return (
<div className='InnerBodyMain'>
<div className='ContainerMain'>
<div className='IBMSecMainGroup IBMSecMainGroupAlt'>
<div className='IBMSecMain IBMSMListWrapper'>
<div className='IBMSMTitleMain'>
2024-11-12 14:22:54 +01:00
<h2 className='IBMSMTitleMainHeading'>{error?.title || title}</h2>
2024-10-23 17:52:53 +02:00
</div>
<div>
2024-11-12 14:22:54 +01:00
<p>{error?.message || message}</p>
2024-10-23 17:52:53 +02:00
</div>
<div
className='IBMSMAction'
style={{
gap: '10px'
}}
>
<Link
to={location.pathname}
className='btn btnMain IBMSMActionBtn'
type='button'
>
Try again
</Link>
2024-10-23 17:52:53 +02:00
<Link
to={appRoutes.home}
className='btn btnMain IBMSMActionBtn'
type='button'
>
Go home
</Link>
</div>
</div>
</div>
</div>
</div>
)
}