-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from CLIMB-TRE/development
Development
- Loading branch information
Showing
18 changed files
with
299 additions
and
128 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
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
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,73 @@ | ||
import Modal from "react-bootstrap/Modal"; | ||
import Form from "react-bootstrap/Form"; | ||
import Accordion from "react-bootstrap/Accordion"; | ||
import Button from "react-bootstrap/Button"; | ||
|
||
interface ErrorModalContentsProps { | ||
error: Error | null; | ||
message?: string; | ||
} | ||
|
||
interface ErrorModalProps extends ErrorModalContentsProps { | ||
show: boolean; | ||
onHide: () => void; | ||
title: string; | ||
} | ||
|
||
function ErrorModalContents(props: ErrorModalContentsProps) { | ||
return ( | ||
<Form> | ||
<Form.Group className="mb-3"> | ||
<Form.Label className="d-flex justify-content-center"> | ||
Error Occurred. | ||
</Form.Label> | ||
{props.message && ( | ||
<Form.Text className="d-flex justify-content-center"> | ||
<b className="onyx-text-pink">{props.message}</b> | ||
</Form.Text> | ||
)} | ||
<Form.Text className="d-flex justify-content-center"> | ||
Please try again or contact CLIMB-TRE support if the problem persists. | ||
</Form.Text> | ||
</Form.Group> | ||
<Accordion> | ||
<Accordion.Item eventKey="0"> | ||
<Accordion.Header>View Error Message</Accordion.Header> | ||
<Accordion.Body> | ||
<small className="onyx-text-pink font-monospace"> | ||
{props.error | ||
? `${props.error.name}: ${props.error.message}` | ||
: "No error message."} | ||
</small> | ||
</Accordion.Body> | ||
</Accordion.Item> | ||
</Accordion> | ||
</Form> | ||
); | ||
} | ||
|
||
function ErrorModal(props: ErrorModalProps) { | ||
return ( | ||
<Modal | ||
className="onyx-modal" | ||
centered | ||
show={props.show} | ||
onHide={props.onHide} | ||
> | ||
<Modal.Header closeButton> | ||
<Modal.Title>{props.title}</Modal.Title> | ||
</Modal.Header> | ||
<Modal.Body> | ||
<ErrorModalContents {...props} /> | ||
</Modal.Body> | ||
<Modal.Footer> | ||
<Button variant="dark" onClick={props.onHide}> | ||
Close | ||
</Button> | ||
</Modal.Footer> | ||
</Modal> | ||
); | ||
} | ||
|
||
export default ErrorModal; | ||
export { ErrorModalContents }; |
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
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
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
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
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
Oops, something went wrong.