Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9f7230

Browse files
committed
Merge branch 'manugill-master'
2 parents f2340bb + 01a3b48 commit c9f7230

File tree

7 files changed

+27
-116
lines changed

7 files changed

+27
-116
lines changed

src/components/ErrorPage/ErrorPage.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import React, { Component, PropTypes } from 'react';
1111
import withStyles from 'isomorphic-style-loader/lib/withStyles';
1212
import s from './ErrorPage.scss';
1313

14-
const title = 'Error';
14+
let title = 'Error';
15+
let content = 'Sorry, a critical error occurred on this page.';
1516

1617
class ErrorPage extends Component {
1718

@@ -20,15 +21,24 @@ class ErrorPage extends Component {
2021
onPageNotFound: PropTypes.func.isRequired,
2122
};
2223

24+
static propTypes = {
25+
statusCode: PropTypes.number,
26+
};
27+
2328
componentWillMount() {
2429
this.context.onSetTitle(title);
2530
}
2631

2732
render() {
33+
if (this.props.statusCode === 404) {
34+
title = 'Page Not Found';
35+
content = 'Sorry, the page you were trying to view does not exist.';
36+
}
37+
2838
return (
2939
<div>
3040
<h1>{title}</h1>
31-
<p>Sorry, an critical error occurred on this page.</p>
41+
<p>{content}</p>
3242
</div>
3343
);
3444
}

src/components/ErrorPage/ErrorPage.scss

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,50 @@
88
*/
99

1010
* {
11-
margin: 0;
1211
line-height: 1.2;
12+
margin: 0;
1313
}
1414

1515
html {
16+
color: #888;
1617
display: table;
17-
width: 100%;
18+
font-family: sans-serif;
1819
height: 100%;
19-
color: #888;
2020
text-align: center;
21-
font-family: sans-serif;
21+
width: 100%;
2222
}
2323

2424
body {
2525
display: table-cell;
26-
margin: 2em auto;
2726
vertical-align: middle;
27+
margin: 2em auto;
2828
}
2929

3030
h1 {
3131
color: #555;
32-
font-weight: 400;
3332
font-size: 2em;
33+
font-weight: 400;
3434
}
3535

3636
p {
3737
margin: 0 auto;
3838
width: 280px;
3939
}
4040

41+
pre {
42+
text-align: left;
43+
margin-top: 2rem;
44+
}
45+
4146
@media only screen and (max-width: 280px) {
4247

43-
body,
44-
p {
48+
body, p {
4549
width: 95%;
4650
}
4751

4852
h1 {
4953
font-size: 1.5em;
5054
margin: 0 0 0.3em;
51-
5255
}
5356

5457
}

src/components/NotFoundPage/NotFoundPage.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/components/NotFoundPage/NotFoundPage.scss

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/components/NotFoundPage/package.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/routes.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import Router from 'react-routing/src/Router';
1212
import fetch from './core/fetch';
1313
import App from './components/App';
1414
import ContentPage from './components/ContentPage';
15-
import NotFoundPage from './components/NotFoundPage';
1615
import ErrorPage from './components/ErrorPage';
1716

1817
const routes = [
@@ -39,9 +38,8 @@ const router = new Router(on => {
3938
return data && data.content && <ContentPage {...data.content} />;
4039
});
4140

42-
on('error', (state, error) => state.statusCode === 404 ?
43-
<App context={state.context} error={error}><NotFoundPage /></App> :
44-
<App context={state.context} error={error}><ErrorPage /></App>
41+
on('error', (state, error) =>
42+
<App context={state.context} error={error}><ErrorPage statusCode={state.statusCode} /></App>
4543
);
4644
});
4745

src/views/error.jade

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ html(lang="en")
55
title Internal Server Error
66
meta(name="viewport", content="width=device-width, initial-scale=1")
77
style.
8-
98
* {
109
line-height: 1.2;
1110
margin: 0;
@@ -39,8 +38,7 @@ html(lang="en")
3938

4039
pre {
4140
text-align: left;
42-
max-width: 1000px;
43-
margin: 0 auto;
41+
margin-top: 2rem;
4442
}
4543

4644
@media only screen and (max-width: 280px) {

0 commit comments

Comments
 (0)