This repository was archived by the owner on Jan 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathNotFound.tsx
More file actions
59 lines (50 loc) · 1.6 KB
/
NotFound.tsx
File metadata and controls
59 lines (50 loc) · 1.6 KB
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
/**
* @prettier
*/
import ListItem from '@material-ui/core/ListItem';
import Typography from '@material-ui/core/Typography';
import withWidth, { isWidthUp } from '@material-ui/core/withWidth';
import React from 'react';
import { RouteComponentProps, withRouter } from 'react-router-dom';
// @ts-ignore
import PackageImg from './img/package.svg';
import { Card, EmptyPackage, Heading, Inner, List, Wrapper } from './styles';
export const NOT_FOUND_TEXT = "Sorry, we couldn't find it...";
// eslint-disable-next-line react/prop-types
const NotFound: React.FC<RouteComponentProps & { width: any }> = ({ history, width }) => {
const handleGoTo = (to: string) => () => {
history.push(to);
};
const handleGoBack = () => () => {
history.goBack();
};
const renderList = () => (
<List>
<ListItem button divider onClick={handleGoTo('/')}>
Home
</ListItem>
<ListItem button divider onClick={handleGoBack()}>
Back
</ListItem>
</List>
);
const renderSubTitle = () => (
<Typography variant="subtitle1">
<div>{"The page you're looking for doesn't exist."}</div>
<div>{'Perhaps these links will help find what you are looking for:'}</div>
</Typography>
);
return (
<Wrapper>
<Inner>
<EmptyPackage alt="404 - Page not found" src={PackageImg} />
<Heading className="not-found-text" variant={isWidthUp('sm', width) ? 'h2' : 'h4'}>
{NOT_FOUND_TEXT}
</Heading>
{renderSubTitle()}
<Card>{renderList()}</Card>
</Inner>
</Wrapper>
);
};
export default withRouter(withWidth()(NotFound));