11import React from "react" ;
22import * as Sentry from '@sentry/react' ;
3- import { ModalBody , ModalBodyHeading } from "./Modal" ;
4- import styled from "styled-components" ;
5- import { colors } from "../../src/theme" ;
3+ import { BoxBody , BoxHeading , BoxEventId } from "./MessageBox.styles" ;
64import { ErrorContext } from "../contexts" ;
75
86export interface ErrorPropTypes {
@@ -11,12 +9,6 @@ export interface ErrorPropTypes {
119 heading ?: string ;
1210}
1311
14- const EventId = styled . div `
15- font-size: 1.4rem;
16- color: ${ colors . palette . neutralMedium } ;
17- margin-top: 1.6rem;
18- ` ;
19-
2012export const Error = ( { heading, children, ...props } : ErrorPropTypes ) => {
2113 const context = React . useContext ( ErrorContext ) ;
2214 const [ lastEventId , setLastEventId ] = React . useState < string | undefined > ( Sentry . lastEventId ( ) ) ;
@@ -36,12 +28,12 @@ export const Error = ({ heading, children, ...props }: ErrorPropTypes) => {
3628 return ( ) => clearInterval ( intervalId ) ;
3729 } , [ lastEventId , context . error ?. eventId ] ) ;
3830
39- return < ModalBody { ...props } data-testid = 'error' >
40- < ModalBodyHeading > { heading ?? `Uh-oh, there's been a glitch` } </ ModalBodyHeading >
31+ return < BoxBody { ...props } data-testid = 'error' >
32+ < BoxHeading > { heading ?? `Uh-oh, there's been a glitch` } </ BoxHeading >
4133 { children ?? < >
4234 We're not quite sure what went wrong. Restart your browser. If this doesn't solve
4335 the problem, visit our < a href = "https://openstax.secure.force.com/help" target = "_blank" > Support Center</ a > .
4436 </ > }
45- < EventId data-testid = 'event-id' > { context . error ?. eventId || lastEventId } </ EventId >
46- </ ModalBody >
37+ < BoxEventId data-testid = 'event-id' > { context . error ?. eventId || lastEventId } </ BoxEventId >
38+ </ BoxBody >
4739} ;
0 commit comments