-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
165573509 Chore (404): Users should be redirected to 404 page if link…
… is missing - If a link is not in the app-router, the app should redirect to a custom 404 page - Write tests [Finishes #165573509]
- Loading branch information
1 parent
7d49c0b
commit a70d6b9
Showing
8 changed files
with
247 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
* { | ||
-webkit-box-sizing: border-box; | ||
box-sizing: border-box; | ||
} | ||
|
||
body { | ||
padding: 0; | ||
margin: 0; | ||
} | ||
|
||
#notfound { | ||
position: relative; | ||
height: 100vh; | ||
} | ||
|
||
#notfound .notfound { | ||
position: absolute; | ||
left: 50%; | ||
top: 50%; | ||
-webkit-transform: translate(-50%, -50%); | ||
-ms-transform: translate(-50%, -50%); | ||
transform: translate(-50%, -50%); | ||
} | ||
|
||
.notfound { | ||
max-width: 460px; | ||
width: 100%; | ||
text-align: center; | ||
line-height: 1.4; | ||
} | ||
|
||
.notfound .notfound-404 { | ||
position: relative; | ||
width: 180px; | ||
height: 180px; | ||
margin: 0px auto 50px; | ||
} | ||
|
||
.notfound .notfound-404>div:first-child { | ||
position: absolute; | ||
left: 0; | ||
right: 0; | ||
top: 0; | ||
bottom: 0; | ||
background: #ffa200; | ||
-webkit-transform: rotate(45deg); | ||
-ms-transform: rotate(45deg); | ||
transform: rotate(45deg); | ||
border: 5px dashed #000; | ||
border-radius: 5px; | ||
} | ||
|
||
.notfound .notfound-404>div:first-child:before { | ||
content: ''; | ||
position: absolute; | ||
left: -5px; | ||
right: -5px; | ||
bottom: -5px; | ||
top: -5px; | ||
-webkit-box-shadow: 0px 0px 0px 5px rgba(0, 0, 0, 0.1) inset; | ||
box-shadow: 0px 0px 0px 5px rgba(0, 0, 0, 0.1) inset; | ||
border-radius: 5px; | ||
} | ||
|
||
.notfound .notfound-404 h1 { | ||
font-family: 'Cabin', sans-serif; | ||
color: #000; | ||
font-weight: 700; | ||
margin: 0; | ||
font-size: 90px; | ||
position: absolute; | ||
top: 50%; | ||
-webkit-transform: translate(-50%, -50%); | ||
-ms-transform: translate(-50%, -50%); | ||
transform: translate(-50%, -50%); | ||
left: 50%; | ||
text-align: center; | ||
height: 40px; | ||
line-height: 40px; | ||
} | ||
|
||
.notfound h2 { | ||
font-family: 'Cabin', sans-serif; | ||
font-size: 33px; | ||
font-weight: 700; | ||
text-transform: uppercase; | ||
letter-spacing: 7px; | ||
} | ||
|
||
.notfound p { | ||
font-family: 'Cabin', sans-serif; | ||
font-size: 16px; | ||
color: #000; | ||
font-weight: 400; | ||
} | ||
|
||
.notfound a { | ||
font-family: 'Cabin', sans-serif; | ||
display: inline-block; | ||
padding: 10px 25px; | ||
border: none; | ||
border-radius: 40px; | ||
color: #fff; | ||
font-size: 14px; | ||
font-weight: 700; | ||
text-transform: uppercase; | ||
text-decoration: none; | ||
-webkit-transition: 0.2s all; | ||
transition: 0.2s all; | ||
} | ||
|
||
.notfound a:hover { | ||
background-color: #2c2c2c; | ||
} | ||
|
||
.link-style { | ||
background-color: transparent !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import NavbarInstance from '../Navbar/Navbar'; | ||
import Footer from '../static/Footer'; | ||
import './404.scss'; | ||
import '../../css/bootstrap.min.css'; | ||
|
||
const Page404 = () => ( | ||
<div className="App-header"> | ||
<header> | ||
<NavbarInstance /> | ||
</header> | ||
<div className="notfound"> | ||
<div className="notfound-404"> | ||
<div /> | ||
<h1>404</h1> | ||
</div> | ||
<h2>Page not found</h2> | ||
<p> | ||
The page you are looking for might have been removed | ||
had its name changed or is temporarily unavailable. | ||
</p> | ||
<Link to="/" className="link-style"> | ||
<button type="button" className="btn btn-outline-success">Home Page</button> | ||
</Link> | ||
</div> | ||
<footer> | ||
<Footer /> | ||
</footer> | ||
</div> | ||
); | ||
|
||
export default Page404; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import Page404 from '../Page404'; | ||
|
||
test('Should render 404 Page', () => { | ||
const wrapper = shallow(<Page404 />); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters