/
PageNotFound.jsx
89 lines (81 loc) · 2.32 KB
/
PageNotFound.jsx
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
85
86
87
88
89
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
import styled from 'styled-components';
import Card from '@material-ui/core/esm/Card';
import BallotIcon from '@material-ui/icons/Ballot';
import Button from '@material-ui/core/esm/Button';
import { withStyles } from '@material-ui/core/esm/styles';
import { renderLog } from '../utils/logging';
import { historyPush, isCordova } from '../utils/cordovaUtils';
class PageNotFound extends Component {
static propTypes = {
classes: PropTypes.object,
};
static getProps () {
return {};
}
render () {
renderLog('PageNotFound'); // Set LOG_RENDER_EVENTS to log all renders
const { classes } = this.props;
return (
<div className="page-content-container">
<div className="container-fluid">
<Helmet title="Page Not Found - We Vote" />
<Wrapper cordova={isCordova()}>
<Card>
<EmptyBallotMessageContainer>
<EmptyBallotText>Page not found.</EmptyBallotText>
<Button
classes={{ root: classes.ballotButtonRoot }}
color="primary"
variant="contained"
onClick={() => historyPush('/ballot')}
>
<BallotIcon classes={{ root: classes.ballotButtonIconRoot }} />
Go to Ballot
</Button>
</EmptyBallotMessageContainer>
</Card>
</Wrapper>
</div>
</div>
);
}
}
const Wrapper = styled.div`
@media (max-width: ${({ theme, cordova }) => (cordova ? undefined : theme.breakpoints.md)}) {
margin: 1em 0;
}
`;
const EmptyBallotMessageContainer = styled.div`
padding: 3em 2em;
display: flex;
flex-flow: column;
align-items: center;
`;
const EmptyBallotText = styled.p`
font-size: 24px;
text-align: center;
margin: 1em 2em 3em;
@media (max-width: ${({ theme }) => theme.breakpoints.md}) {
margin: 1em;
}
`;
const styles = theme => ({
ballotIconRoot: {
width: 150,
height: 150,
color: 'rgb(171, 177, 191)',
},
ballotButtonIconRoot: {
marginRight: 8,
},
ballotButtonRoot: {
width: 250,
[theme.breakpoints.down('md')]: {
width: '100%',
},
},
});
export default withStyles(styles)(PageNotFound);