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

Skip to content

Commit 385a5f9

Browse files
committed
Adjust the rendering of the error page
1 parent ec26837 commit 385a5f9

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

React JS Workshop/origami/src/errorBoundary.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import React from "react";
2+
import image from './images/404.png'
3+
import styles from './errorBoundary.module.css'
24

35
class ErrorBoundary extends React.Component {
46
constructor(props) {
@@ -17,9 +19,13 @@ class ErrorBoundary extends React.Component {
1719

1820
render() {
1921
if (this.state.isThereAnError) {
20-
return <div>{"Something went wrong (error boundary)"}</div>;
22+
return <div>
23+
<div className={styles.textContainer}>The page you're looking for is missing. Are you missing something? </div>;
24+
<div className={styles.image}>
25+
<img src={image} className={styles.image}></img>
26+
</div>
27+
</div>
2128
}
22-
2329
return this.props.children;
2430
}
2531
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.textContainer{
2+
text-align: center;
3+
font-size: 20px;
4+
text-shadow: 2px 2px 2px rgba(136, 184, 156, 0.66);
5+
}
6+
7+
.image{
8+
text-align: center;
9+
font-size: large;
10+
}
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import React from "react";
2+
import image from '../../images/404.png'
23

3-
const ErrorPage = () => <div>Something went wrong (from Error Page) </div>;
4-
4+
const ErrorPage = () => {
5+
<div>
6+
<div>The page you're looking for is missing. Are you missing something? </div>;
7+
<img src ={image}></img>
8+
</div>
9+
}
510
export default ErrorPage;

0 commit comments

Comments
 (0)