Skip to content

Commit ab18727

Browse files
authored
feat: 404 page for default redirects (#57)
1 parent dfabc3b commit ab18727

File tree

3 files changed

+68
-1
lines changed

3 files changed

+68
-1
lines changed

src/Routes.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Login from './components/Login'
44
import Register from './components/Register'
55
import Dashboard from './components/Dashboard'
66
import Forms from './components/Forms'
7+
import ErrorPage from './components/ErrorPage'
78
import Submission from './components/Submission'
89
import Questions from './components/Questions'
910
import { login, register, dashboard, forms, upload, submission, urlBaseFrontend } from './urls'
@@ -23,7 +24,7 @@ export default class Routes extends Component {
2324
<AuthRoute path={login()} component={Login} />
2425
<AuthRoute path={register()} component={Register} />
2526
<Route path={upload()} component={Upload} />
26-
<Route render={() => <Redirect to='/' />} />
27+
<AuthRoute component={ErrorPage} />
2728
</Switch>
2829
</>
2930
)

src/components/ErrorPage.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import React, { Component } from 'react'
2+
import './../styles/ErrorPage.css'
3+
import './../styles/App.css'
4+
import { Header } from 'semantic-ui-react';
5+
6+
class ErrorPage extends Component {
7+
render() {
8+
return (
9+
<div className="errorPage">
10+
<div className="errorPage_content">
11+
<Header
12+
as='h1'
13+
content='404'
14+
style={{
15+
color: '#2185D0',
16+
fontSize: '10vw',
17+
fontWeight: 'bolder',
18+
lineHeight: '1em',
19+
textTransform: 'uppercase',
20+
}}
21+
/>
22+
<Header
23+
as='h4'
24+
content='Oops! Page Not Found'
25+
style={{
26+
fontSize: '2em',
27+
marginBottom: '20px',
28+
textTransform: 'uppercase',
29+
maxWidth: '600px',
30+
color: '#0d0d0d',
31+
}}
32+
/>
33+
<p>Sorry, the page you were looking for doesn't exist. If you think something is wrong, try again.</p>
34+
</div>
35+
</div>
36+
)
37+
}
38+
}
39+
40+
export default ErrorPage

src/styles/ErrorPage.css

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
* {
2+
margin: 0;
3+
padding: 0;
4+
}
5+
6+
.errorPage {
7+
position: absolute;
8+
top: 15%;
9+
left: 17%;
10+
right: 17%;
11+
color: whitesmoke;
12+
bottom: 20%;
13+
display: flex;
14+
align-items: center;
15+
justify-content: center;
16+
}
17+
18+
.errorPage_content {
19+
max-width: 600px;
20+
text-align: center;
21+
}
22+
23+
.errorPage_content p {
24+
font-size: 1.4em;
25+
color: gray;
26+
}

0 commit comments

Comments
 (0)