-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path404.tsx
84 lines (75 loc) · 1.96 KB
/
404.tsx
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
81
82
83
84
import { useContext, useEffect } from 'react';
import toast from 'react-hot-toast';
import { NextSeo } from 'next-seo';
import { ThemeContext } from 'styled-components';
import LottieAnimation from '@/components/LottieAnimation';
import loadingAnimation from '@/animation/404-error.json';
import HotToast from '@/components/HotToast';
import Container from '@/styles/pages/error';
const Custom404 = () => {
const { colors } = useContext(ThemeContext);
// Redirecionando para a pagina home
useEffect(() => {
toast.error('Page not found', {
position: 'top-center',
style: {
borderRadius: '6px',
padding: '16px',
fontWeight: 500,
fontSize: '14px',
color: `${colors.white}`,
boxShadow: '0px 7px 8px 2px rgb(0 0 0 / 41%)',
},
});
setTimeout(() => {
toast('You will be redirected to the home page', {
icon: '⌛',
position: 'top-center',
style: {
borderRadius: '6px',
padding: '16px',
fontWeight: 500,
fontSize: '14px',
color: `${colors.white}`,
boxShadow: '0px 7px 8px 2px rgb(0 0 0 / 41%)',
},
});
}, 1000);
// setTimeout(() => {
// // replace: não adiciona uma nova entrada url (nao add a rota no caminho)
// router.replace('/');
// }, 6000);
}, []);
return (
<>
<NextSeo
title="Not found"
noindex
nofollow
additionalMetaTags={[
{
httpEquiv: 'refresh',
content: '5; url=/',
},
]}
additionalLinkTags={[
{
rel: 'icon',
type: 'image/svg+xml',
href: '/error.svg',
},
]}
/>
<Container>
<LottieAnimation
ID="404"
Width={600}
Height={600}
LoadingAnimation={loadingAnimation}
/>
</Container>
<HotToast />
</>
);
};
export default Custom404;