File tree Expand file tree Collapse file tree 6 files changed +116
-1
lines changed
Expand file tree Collapse file tree 6 files changed +116
-1
lines changed Original file line number Diff line number Diff line change 11import React from "react" ;
22import LandingPage from "./page/landing-page/landing-page.jsx" ;
33import BasicPage from "./page/basic-page/basic-page.jsx" ;
4+ import ProblemPages from "./page/system/problem-pages.jsx" ;
45
56/**
67 * PageTypes maps server resource types to the component that should render them.
@@ -20,7 +21,18 @@ const PageTypes = {
2021 */
2122const App = ( { resource, problem } ) => {
2223 if ( problem ) {
23- return ( < div > < h1 > Error</ h1 > < p > An unexpected problem occurred.</ p > </ div > ) ;
24+ const statusCode = problem . response . status ;
25+ const phrases = {
26+ 403 : 'Sign in or get out!' ,
27+ 404 : "Oops, this is not the page you're looking for." ,
28+ } ;
29+ const text = phrases ?. [ statusCode ] || 'Something went terribly, terribly wrong.' ;
30+ return (
31+ < ProblemPages
32+ status = { statusCode }
33+ text = { text }
34+ />
35+ ) ;
2436 }
2537 // Extract the type of the current resource.
2638 const { type } = resource ;
Original file line number Diff line number Diff line change 1+ import React from "react" ;
2+ import './problem-pages.pcss' ;
3+
4+ const ProblemPages = ( { status, text} ) => {
5+ return (
6+ < div className = { "main-content error-pages page-" + status } >
7+ < div className = "content-wrapper" >
8+ < div className = "icon" > </ div >
9+ < h2 className = { 'page-title' } > { status } </ h2 >
10+ < p className = { 'text' } > { text } </ p >
11+ </ div >
12+ </ div >
13+ ) ;
14+ } ;
15+
16+ export default ProblemPages ;
Original file line number Diff line number Diff line change 1+ .main-content.error-pages {
2+ height : 100 vh ;
3+ position : relative;
4+ overflow : hidden;
5+
6+ &::after {
7+ content : '' ;
8+ position : absolute;
9+ background-image : url("../../static/images/intro-background.svg" );
10+ padding : 140 px 0 ;
11+ background-size : cover;
12+ background-repeat : no-repeat;
13+ background-position : top;
14+ animation : 2.5 s fadeInUp;
15+ width : 100 % ;
16+ height : 100 % ;
17+ top : calc (100 % - 300 px );
18+ z-index : -1 ;
19+
20+ }
21+
22+ & .page-403 {
23+ .content-wrapper {
24+ .icon {
25+ mask-image : url("./../../static/images/lock.svg" );
26+ }
27+ }
28+ }
29+
30+ & .page-404 {
31+ .content-wrapper {
32+ .icon {
33+ mask-image : url("./../../static/images/not-found.svg" );
34+ mask-size : 400 px ;
35+ }
36+ }
37+ }
38+
39+ & .page-500 {
40+ .content-wrapper {
41+ .icon {
42+ mask-image : url("./../../static/images/error.svg" );
43+ }
44+ }
45+ }
46+
47+ .content-wrapper {
48+ display : flex;
49+ align-items : center;
50+ flex-direction : column;
51+ justify-content : center;
52+ height : 100 % ;
53+ text-align : center;
54+ animation : 2 s fadeInUp;
55+
56+ .icon {
57+ display : block;
58+ width : 400 px ;
59+ height : 240 px ;
60+ background : var (--color-primary );
61+ mask-repeat : no-repeat;
62+ mask-size : contain;
63+ mask-position : center;
64+ }
65+
66+ h2 {
67+ margin : 0 ;
68+ font-size : 72 px ;
69+ }
70+
71+ p .text {
72+ margin : 0 ;
73+ font-size : 24 px ;
74+ }
75+ }
76+ }
You can’t perform that action at this time.
0 commit comments