|
1 | | -import { Button } from '@gouvfr-lasuite/cunningham-react'; |
2 | | -import Head from 'next/head'; |
3 | | -import Image from 'next/image'; |
4 | 1 | import { ReactElement } from 'react'; |
5 | 2 | import { useTranslation } from 'react-i18next'; |
6 | | -import styled from 'styled-components'; |
7 | 3 |
|
8 | 4 | import error_img from '@/assets/icons/error-coffee.png'; |
9 | | -import { Box, Icon, StyledLink, Text } from '@/components'; |
| 5 | +import { ErrorPage } from '@/components'; |
10 | 6 | import { PageLayout } from '@/layouts'; |
11 | 7 | import { NextPageWithLayout } from '@/types/next'; |
12 | 8 |
|
13 | | -const StyledButton = styled(Button)` |
14 | | - width: fit-content; |
15 | | -`; |
16 | | - |
17 | 9 | const Page: NextPageWithLayout = () => { |
18 | 10 | const { t } = useTranslation(); |
19 | 11 |
|
20 | | - const errorTitle = t('An unexpected error occurred.'); |
21 | | - |
22 | 12 | return ( |
23 | | - <> |
24 | | - <Head> |
25 | | - <title> |
26 | | - {errorTitle} - {t('Docs')} |
27 | | - </title> |
28 | | - <meta |
29 | | - property="og:title" |
30 | | - content={`${errorTitle} - ${t('Docs')}`} |
31 | | - key="title" |
32 | | - /> |
33 | | - </Head> |
34 | | - <Box |
35 | | - $align="center" |
36 | | - $margin="auto" |
37 | | - $gap="md" |
38 | | - $padding={{ bottom: '2rem' }} |
39 | | - > |
40 | | - <Text as="h1" $textAlign="center" className="sr-only"> |
41 | | - {errorTitle} - {t('Docs')} |
42 | | - </Text> |
43 | | - <Image |
44 | | - src={error_img} |
45 | | - alt="" |
46 | | - width={300} |
47 | | - style={{ |
48 | | - maxWidth: '100%', |
49 | | - height: 'auto', |
50 | | - }} |
51 | | - /> |
52 | | - |
53 | | - <Text |
54 | | - as="p" |
55 | | - $textAlign="center" |
56 | | - $maxWidth="350px" |
57 | | - $theme="neutral" |
58 | | - $margin="0" |
59 | | - > |
60 | | - {t( |
61 | | - 'An unexpected error occurred. Go grab a coffee or try to refresh the page.', |
62 | | - )} |
63 | | - </Text> |
64 | | - |
65 | | - <Box $direction="row" $gap="sm"> |
66 | | - <StyledLink href="/"> |
67 | | - <StyledButton |
68 | | - color="neutral" |
69 | | - icon={ |
70 | | - <Icon |
71 | | - iconName="house" |
72 | | - variant="symbols-outlined" |
73 | | - $withThemeInherited |
74 | | - /> |
75 | | - } |
76 | | - > |
77 | | - {t('Home')} |
78 | | - </StyledButton> |
79 | | - </StyledLink> |
80 | | - |
81 | | - <StyledButton |
82 | | - color="neutral" |
83 | | - variant="bordered" |
84 | | - icon={ |
85 | | - <Icon |
86 | | - iconName="refresh" |
87 | | - variant="symbols-outlined" |
88 | | - $withThemeInherited |
89 | | - /> |
90 | | - } |
91 | | - onClick={() => window.location.reload()} |
92 | | - > |
93 | | - {t('Refresh page')} |
94 | | - </StyledButton> |
95 | | - </Box> |
96 | | - </Box> |
97 | | - </> |
| 13 | + <ErrorPage |
| 14 | + image={error_img} |
| 15 | + description={t( |
| 16 | + 'An unexpected error occurred. Go grab a coffee or try to refresh the page.', |
| 17 | + )} |
| 18 | + /> |
98 | 19 | ); |
99 | 20 | }; |
100 | 21 |
|
|
0 commit comments