-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Style the error boundaries component (#1910)
* style it * catter for dark design Co-authored-by: Andrew Snaith <asnaith@users.noreply.github.com> Co-authored-by: Tanmoy Basak Anjan <tanmoy3399@gmail.com>
- Loading branch information
1 parent
012f0ca
commit 58466af
Showing
2 changed files
with
112 additions
and
27 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
107 changes: 107 additions & 0 deletions
107
packages/files-ui/src/Components/Modules/ErrorModal.tsx
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,107 @@ | ||
/* eslint-disable max-len */ | ||
import React from "react" | ||
import { Button, Modal, Typography } from "@chainsafe/common-components" | ||
import { ROUTE_LINKS } from "../FilesRoutes" | ||
|
||
interface Props { | ||
error: Error | ||
componentStack: string | null | ||
eventId: string | null | ||
resetError: () => void | ||
} | ||
|
||
const ErrorModal = ({ error, componentStack, resetError }: Props) => { | ||
|
||
const generalStyle = { | ||
margin: "1rem", | ||
backgrounColor: "var(--gray1)", | ||
color: "var(--gray9)" | ||
} | ||
|
||
return <Modal | ||
active | ||
closePosition="none" | ||
onClose={resetError} | ||
> | ||
<Typography | ||
variant="h2" | ||
style={{ | ||
marginTop: "3rem", | ||
display: "inline-block", | ||
...generalStyle | ||
}} | ||
> | ||
An unexpected error occured | ||
</Typography> | ||
<Typography | ||
component="p" | ||
style={{ ...generalStyle }} | ||
> | ||
If you would like to provide additional info to help us debug and resolve the issue, reach out on <a | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
href={ROUTE_LINKS.DiscordInvite} | ||
> | ||
Discord | ||
</a> | ||
</Typography> | ||
<br/> | ||
<Typography | ||
variant="h4" | ||
style={{ | ||
...generalStyle, | ||
display: "inline-block" | ||
}} | ||
> | ||
Error: | ||
</Typography> | ||
<Typography | ||
style={{ | ||
...generalStyle, | ||
backgroundColor: "ghostwhite", | ||
padding: "1rem", | ||
marginTop: 0, | ||
color: "black" | ||
}} | ||
component="p" | ||
> | ||
<pre>{error?.message.toString()}</pre> | ||
</Typography> | ||
<Typography | ||
variant="h4" | ||
style={{ | ||
...generalStyle, | ||
display: "inline-block" | ||
}} | ||
> | ||
Stack: | ||
</Typography> | ||
<Typography | ||
component="p" | ||
style={{ | ||
...generalStyle, | ||
height: "5rem", | ||
overflow: "auto", | ||
padding: "1rem", | ||
border: "2px solid ghostwhite", | ||
marginTop: 0 | ||
}} | ||
> | ||
{componentStack} | ||
</Typography> | ||
<div | ||
style={{ | ||
...generalStyle, | ||
display: "flex", | ||
justifyContent: "center" | ||
|
||
}} | ||
> | ||
<Button onClick={resetError}> | ||
Close | ||
</Button> | ||
</div> | ||
</Modal> | ||
} | ||
|
||
export default ErrorModal |