summaryrefslogtreecommitdiffstats
path: root/src/pages/404.tsx
blob: d5b2e86a87ca5dea90bf56894d0ed11f78cf4414 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import { getLayout } from '@components/Layouts/Layout';
import PostHeader from '@components/PostHeader/PostHeader';
import styles from '@styles/pages/Page.module.scss';
import { NextPageWithLayout } from '@ts/types/app';
import { settings } from '@utils/config';
import { getIntlInstance, loadTranslation } from '@utils/helpers/i18n';
import { GetStaticProps, GetStaticPropsContext } from 'next';
import Head from 'next/head';
import Link from 'next/link';
import { FormattedMessage, useIntl } from 'react-intl';

const Error404: NextPageWithLayout = () => {
  const intl = useIntl();

  const pageTitle = intl.formatMessage(
    {
      defaultMessage: 'Error 404: Page not found - {websiteName}',
      description: '404Page: SEO - Page title',
    },
    { websiteName: settings.name }
  );
  const pageDescription = intl.formatMessage({
    defaultMessage: 'Page not found.',
    description: '404Page: SEO - Meta description',
  });

  return (
    <>
      <Head>
        <title>{pageTitle}</title>
        <meta name="description" content={pageDescription} />
      </Head>
      <div className={`${styles.article} ${styles['article--no-comments']}`}>
        <PostHeader
          title={intl.formatMessage({
            defaultMessage: 'Page not found',
            description: '404Page: page title',
          })}
        />
        <div className={styles.body}>
          <FormattedMessage
            defaultMessage="Sorry, it seems that the page your are looking for does not exist. If you think this path should work, feel free to <link>contact me</link> with the necessary information so that I can fix the problem."
            description="404Page: page body"
            values={{
              link: (chunks: string) => (
                <Link href="/contact/">
                  <a>{chunks}</a>
                </Link>
              ),
            }}
          />
        </div>
      </div>
    </>
  );
};

Error404.getLayout = getLayout;

export const getStaticProps: GetStaticProps = async (
  context: GetStaticPropsContext
) => {
  const intl = await getIntlInstance();
  const breadcrumbTitle = intl.formatMessage({
    defaultMessage: 'Error 404',
    description: '404Page: breadcrumb item',
  });
  const { locale } = context;
  const translation = await loadTranslation(locale);

  return {
    props: {
      breadcrumbTitle,
      locale,
      translation,
    },
  };
};

export default Error404;
>border 0s; &:hover { --icon-size: #{fun.convert-px(25)}; a { > svg { :global { animation: pulse 1.5s ease-in-out 0.5s infinite; } } &:hover { > svg { animation: none; } } } } &:active { --icon-size: 0; } } .cover { width: auto; height: fun.convert-px(100); margin: 0 auto var(--spacing-sm); position: relative; border: fun.convert-px(1) solid var(--color-border); } h2.title { background: none; text-shadow: none; } @include mix.media("screen") { @include mix.dimensions("xs") { .wrapper { margin: 0; padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-md); border: fun.convert-px(1) solid var(--color-primary-dark); border-radius: fun.convert-px(3); box-shadow: fun.convert-px(1) fun.convert-px(1) fun.convert-px(1) 0 var(--color-shadow), fun.convert-px(3) fun.convert-px(3) fun.convert-px(3) fun.convert-px(-1) var(--color-shadow-light), fun.convert-px(5) fun.convert-px(5) fun.convert-px(7) fun.convert-px(-1) var(--color-shadow-light); } .read-more { font-size: var(--font-size-sm); } } @include mix.dimensions("sm") { .wrapper { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); grid-template-rows: repeat(3, max-content); column-gap: var(--spacing-md); } .cover { grid-column: 2; grid-row: 1; margin: 0 0 var(--spacing-sm); } .header { grid-column: 1; grid-row: 1; align-self: center; } .meta { grid-column: 2; grid-row: 2 / 4; } .body { grid-column: 1; grid-row: 2; } .footer { grid-column: 1; grid-row: 3; } .read-more { margin: 0; } } }