Skip to content

Commit

Permalink
feat: Added error modal component
Browse files Browse the repository at this point in the history
  • Loading branch information
tbalar-splunk committed Mar 3, 2021
1 parent e690000 commit bbde4cf
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React, { useState } from 'react';
import Button from '@splunk/react-ui/Button';
import Modal from '@splunk/react-ui/Modal';
import Message from '@splunk/react-ui/Message';

import {getFormattedMessage} from '../util/messageUtil';

function ErrorModal(props) {

const [open, setOpen] = useState(props.open);

const handleRequestClose = () => {
setOpen(false);
};

return (
<Modal
onRequestClose={handleRequestClose}
open={open}
style={{ width: '600px' }}
>
<Modal.Header
onRequestClose={handleRequestClose}
title={getFormattedMessage(104)}
/>
<Modal.Body>
<Message appearance="fill" type="error">
{props.message}
</Message>
</Modal.Body>
<Modal.Footer>
<Button appearance="primary" onClick={handleRequestClose} label="OK" />
</Modal.Footer>
</Modal>
);
}

export default ErrorModal;

0 comments on commit bbde4cf

Please sign in to comment.