|
1 | | -import { |
2 | | - Heading, |
3 | | - Text, |
4 | | - Box, |
5 | | - Template, |
6 | | - TemplateMain, |
7 | | - TemplateContent, |
8 | | - TemplateHeader, |
9 | | - TemplateBreakout, |
10 | | - Link as DSLink, |
11 | | -} from "@nypl/design-system-react-components"; |
12 | | -import Link from "next/link"; |
| 1 | +import { Text } from "@nypl/design-system-react-components"; |
13 | 2 | import React from "react"; |
14 | | -import Breadcrumbs from "../Breadcrumb"; |
15 | | -import { BrokenBook as BrokenBookIcon } from "../Icons/BrokenBook"; |
16 | 3 | import { NRError } from "../../logger/newrelic"; |
| 4 | +import { BackToHomeLink, ContactUsLink, ErrorComponent } from "../Error"; |
17 | 5 |
|
18 | 6 | interface ErrorBoundaryProps { |
19 | 7 | children: React.ReactNode; |
@@ -58,46 +46,21 @@ class ErrorBoundary extends React.Component< |
58 | 46 | render() { |
59 | 47 | if (this.state.hasError) { |
60 | 48 | return ( |
61 | | - <ErrorComponent> |
62 | | - <Box mb="xl"> |
63 | | - <BrokenBookIcon /> |
64 | | - </Box> |
65 | | - <Box textAlign="center"> |
66 | | - <Heading level="h2" size="heading3" mb="m"> |
67 | | - There was an unexpected error |
68 | | - </Heading> |
| 49 | + <ErrorComponent |
| 50 | + heading="There was an unexpected error" |
| 51 | + description={ |
69 | 52 | <Text maxWidth="730px" margin="auto"> |
70 | 53 | We couldn't process your request at this time. Your application |
71 | 54 | progress may not have been saved. Try starting a{" "} |
72 | | - <Link href="/new">new application</Link> in a few minutes or{" "} |
73 | | - <DSLink href="https://www.nypl.org/get-help/contact-us"> |
74 | | - contact us |
75 | | - </DSLink>{" "} |
76 | | - if the error persists. |
| 55 | + <BackToHomeLink /> in a few minutes or <ContactUsLink /> if the |
| 56 | + error persists. |
77 | 57 | </Text> |
78 | | - </Box> |
79 | | - </ErrorComponent> |
| 58 | + } |
| 59 | + /> |
80 | 60 | ); |
81 | 61 | } |
82 | 62 | return this.props.children; |
83 | 63 | } |
84 | 64 | } |
85 | 65 |
|
86 | | -export const ErrorComponent = ({ children }: { children: React.ReactNode }) => { |
87 | | - return ( |
88 | | - <Template variant="narrow" gap="0!"> |
89 | | - <TemplateHeader id="mainHeader" m="0!" dir="ltr"> |
90 | | - <TemplateBreakout> |
91 | | - <Breadcrumbs /> |
92 | | - </TemplateBreakout> |
93 | | - </TemplateHeader> |
94 | | - <TemplateMain id="mainContent"> |
95 | | - <TemplateContent my="xxl" textAlign="center"> |
96 | | - {children} |
97 | | - </TemplateContent> |
98 | | - </TemplateMain> |
99 | | - </Template> |
100 | | - ); |
101 | | -}; |
102 | | - |
103 | 66 | export default ErrorBoundary; |
0 commit comments