PageNotFound.tsx 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. import React, { Component } from "react";
  2. import styled from "styled-components";
  3. import { RouteComponentProps, withRouter } from "react-router";
  4. import { pushFiltered } from "shared/routing";
  5. type PropsType = RouteComponentProps & {};
  6. type StateType = {};
  7. class PageNotFound extends Component<PropsType, StateType> {
  8. state = {};
  9. render() {
  10. let { pathname } = this.props.location;
  11. let params = this.props.match.params as any;
  12. let { baseRoute } = params;
  13. if (baseRoute === "applications") {
  14. return (
  15. <StyledPageNotFound>
  16. <Mega>
  17. 404
  18. <Inside>Application Not Found</Inside>
  19. </Mega>
  20. <Flex>
  21. <BackButton
  22. width="140px"
  23. onClick={() =>
  24. pushFiltered(this.props, "/applications", ["project_id"])
  25. }
  26. >
  27. <i className="material-icons">arrow_back</i>
  28. Applications
  29. </BackButton>
  30. {pathname && (
  31. <>
  32. <Splitter>|</Splitter>
  33. <Helper>Could not find "{pathname}"</Helper>
  34. </>
  35. )}
  36. </Flex>
  37. </StyledPageNotFound>
  38. );
  39. } else if (baseRoute === "jobs") {
  40. return (
  41. <StyledPageNotFound>
  42. <Mega>
  43. 404
  44. <Inside>Job Not Found</Inside>
  45. </Mega>
  46. <Flex>
  47. <BackButton
  48. width="90px"
  49. onClick={() => pushFiltered(this.props, "/jobs", ["project_id"])}
  50. >
  51. <i className="material-icons">arrow_back</i>
  52. Jobs
  53. </BackButton>
  54. {pathname && (
  55. <>
  56. <Splitter>|</Splitter>
  57. <Helper>Could not find "{pathname}"</Helper>
  58. </>
  59. )}
  60. </Flex>
  61. </StyledPageNotFound>
  62. );
  63. }
  64. return (
  65. <StyledPageNotFound>
  66. <Mega>
  67. 404
  68. <Inside>Page Not Found</Inside>
  69. </Mega>
  70. <Flex>
  71. <BackButton
  72. width="145px"
  73. onClick={() =>
  74. pushFiltered(this.props, "/dashboard", ["project_id"])
  75. }
  76. >
  77. <i className="material-icons">home</i>
  78. Return Home
  79. </BackButton>
  80. {pathname && (
  81. <>
  82. <Splitter>|</Splitter>
  83. <Helper>Could not find "{pathname}"</Helper>
  84. </>
  85. )}
  86. </Flex>
  87. </StyledPageNotFound>
  88. );
  89. }
  90. }
  91. export default withRouter(PageNotFound);
  92. const Splitter = styled.div`
  93. margin: 0 20px;
  94. font-size: 27px;
  95. font-weight: 200;
  96. color: #ffffff15;
  97. `;
  98. const Flex = styled.div`
  99. display: flex;
  100. align-items: center;
  101. justify-content: center;
  102. `;
  103. const Helper = styled.div`
  104. font-size: 15px;
  105. max-width: 550px;
  106. margin-right: -50px;
  107. `;
  108. const BackButton = styled.div`
  109. display: flex;
  110. align-items: center;
  111. justify-content: space-between;
  112. cursor: pointer;
  113. font-size: 13px;
  114. height: 35px;
  115. padding: 5px 16px;
  116. padding-right: 15px;
  117. border: 1px solid #ffffff55;
  118. border-radius: 100px;
  119. width: ${(props: { width: string }) => props.width};
  120. color: white;
  121. background: #ffffff11;
  122. :hover {
  123. background: #ffffff22;
  124. }
  125. > i {
  126. color: white;
  127. font-size: 16px;
  128. margin-right: 6px;
  129. margin-left: -2px;
  130. }
  131. `;
  132. const StyledPageNotFound = styled.div`
  133. font-family: "Work Sans", sans-serif;
  134. color: #6f6f6f;
  135. font-size: 16px;
  136. user-select: none;
  137. margin-top: -80px;
  138. width: 100%;
  139. height: 100%;
  140. display: flex;
  141. flex-direction: column;
  142. align-items: center;
  143. justify-content: center;
  144. `;
  145. const Mega = styled.div`
  146. font-size: 200px;
  147. color: #ffffff06;
  148. position: relative;
  149. font-weight: bold;
  150. text-align: center;
  151. > i {
  152. font-size: 23px;
  153. margin-right: 12px;
  154. }
  155. `;
  156. const Inside = styled.div`
  157. position: absolute;
  158. color: #6f6f6f;
  159. top: 0;
  160. left: 0;
  161. width: 100%;
  162. height: 100%;
  163. display: flex;
  164. align-items: center;
  165. justify-content: center;
  166. font-weight: 400;
  167. font-size: 20px;
  168. > i {
  169. font-size: 23px;
  170. margin-right: 12px;
  171. }
  172. `;