import { Helmet } from 'react-helmet-async' import nikumaru from '@/assets/fonts/nikumaru.otf' import errorImg from '@/assets/images/not-found.gif' import MainArea from '@/components/layout/MainArea' import { SITE_TITLE } from '@/config' import { useUITranslation } from '@/lib/useUITranslation' import type { FC } from 'react' type Props = { status: number } const ErrorScreen: FC = ({ status }) => { const { message: translate, label } = useUITranslation ('errors') const [message]: [string, string, string] = (() => { switch (status) { case 403: case 404: case 500: case 503: return [translate (`${ status }.message`).text, translate (`${ status }.right`).text, translate (`${ status }.left`).text] default: throw new Error } }) () const title = message.replaceAll ('(', ' (').replaceAll (')', ')') const style = document.createElement ('style') style.innerHTML = ` @font-face { font-family: 'Nikumaru'; src: url(${ nikumaru }) format('opentype'); }` document.head.appendChild (style) return ( {title} | {SITE_TITLE}

{status}

{label (`${ status }.left`)}

{translate

{label (`${ status }.right`)}

{label (`${ status }.message`)}

) } export default ErrorScreen