Skip to content

Commit

Permalink
Fix/404 page (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryczko authored Jul 23, 2023
1 parent 31e3e3d commit fcbc5cf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 40 deletions.
7 changes: 3 additions & 4 deletions locales/en/404.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"title": "Page Not Found",
"content": "FormsLab (404) - This page cannot be found.",
"Heading": "This page cannot be found.",
"Description": "Redirecting to Homepage in",
"RedirectSecond": "second",
"RedirectSeconds": "seconds"
"header": "This page cannot be found.",
"description": "Redirecting to Homepage in",
"backToHome": "Back to home page"
}
24 changes: 16 additions & 8 deletions src/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
import Head from 'next/head';
import useRedirectWithTimeout from 'shared/hooks/useRedirectWithTimeout';
import useTranslation from 'next-translate/useTranslation';
import ButtonLink from 'shared/components/ButtonLink/ButtonLink';
import { ButtonVariant } from 'shared/components/Button/Button';

export default function FourOhFour() {
const { secondsRemaining } = useRedirectWithTimeout('/', 5);
const { t } = useTranslation('404');
return (
<>
<Head>
<title>{t('title')}</title>
<meta name="description" content={t('content')} />
</Head>
<h1 className="text-center text-2xl font-bold">{t('Heading')}</h1>
<h2 className="mt-4 text-center text-xl">
{t('Description')}
&nbsp;{secondsRemaining}&nbsp;
{secondsRemaining > 1 ? t('RedirectSeconds') : t('RedirectSecond')}.
</h2>
<section className="absolute left-1/2 top-1/3 w-full -translate-x-1/2 -translate-y-1/2">
<div className="px-4 py-8 lg:px-6 lg:py-16">
<h1 className="text-primary-300 mb-2 text-7xl font-extrabold tracking-tight text-indigo-300 lg:text-8xl">
404
</h1>

<p className="mb-7 text-lg font-light text-gray-500 dark:text-gray-400">
{t('header')}
</p>
<ButtonLink href="/" variant={ButtonVariant.PRIMARY}>
{t('backToHome')}
</ButtonLink>
</div>
</section>
</>
);
}
28 changes: 0 additions & 28 deletions src/shared/hooks/useRedirectWithTimeout.ts

This file was deleted.

1 comment on commit fcbc5cf

@vercel
Copy link

@vercel vercel bot commented on fcbc5cf Jul 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

formslab – ./

formslab.vercel.app
formslab-git-main-ryczko.vercel.app
formslab-ryczko.vercel.app

Please sign in to comment.