| 1 |
import DialogWrapper from './dialog-wrapper'; |
| 2 |
import DialogContent from './dialog-content'; |
| 3 |
import DialogTitle from './dialog-title'; |
| 4 |
import DialogText from './dialog-text'; |
| 5 |
import DialogActions from './dialog-actions'; |
| 6 |
import DialogButton from './dialog-button'; |
| 7 |
|
| 8 |
import './dialog.scss'; |
| 9 |
|
| 10 |
export default function Dialog( props ) { |
| 11 |
return ( |
| 12 |
<DialogWrapper onSubmit={ props.onSubmit } onClose={ props.onClose }> |
| 13 |
<DialogContent> |
| 14 |
{ props.title && <DialogTitle>{ props.title }</DialogTitle> } |
| 15 |
{ props.text && <DialogText>{ props.text }</DialogText> } |
| 16 |
{ props.children } |
| 17 |
</DialogContent> |
| 18 |
<DialogActions> |
| 19 |
<DialogButton |
| 20 |
key="dismiss" |
| 21 |
text={ props.dismissButtonText } |
| 22 |
onClick={ props.dismissButtonOnClick } |
| 23 |
url={ props.dismissButtonUrl } |
| 24 |
target={ props.dismissButtonTarget } |
| 25 |
// eslint-disable-next-line jsx-a11y/tabindex-no-positive |
| 26 |
tabIndex="2" |
| 27 |
/> |
| 28 |
<DialogButton |
| 29 |
key="approve" |
| 30 |
text={ props.approveButtonText } |
| 31 |
onClick={ props.approveButtonOnClick } |
| 32 |
url={ props.approveButtonUrl } |
| 33 |
target={ props.approveButtonTarget } |
| 34 |
color={ props.approveButtonColor } |
| 35 |
elRef={ props.approveButtonRef } |
| 36 |
// eslint-disable-next-line jsx-a11y/tabindex-no-positive |
| 37 |
tabIndex="1" |
| 38 |
/> |
| 39 |
</DialogActions> |
| 40 |
</DialogWrapper> |
| 41 |
); |
| 42 |
} |
| 43 |
|
| 44 |
Dialog.propTypes = { |
| 45 |
title: PropTypes.any, |
| 46 |
text: PropTypes.any, |
| 47 |
children: PropTypes.any, |
| 48 |
onSubmit: PropTypes.func, |
| 49 |
onClose: PropTypes.func, |
| 50 |
dismissButtonText: PropTypes.string.isRequired, |
| 51 |
dismissButtonOnClick: PropTypes.func, |
| 52 |
dismissButtonUrl: PropTypes.string, |
| 53 |
dismissButtonTarget: PropTypes.string, |
| 54 |
approveButtonText: PropTypes.string.isRequired, |
| 55 |
approveButtonOnClick: PropTypes.func, |
| 56 |
approveButtonUrl: PropTypes.string, |
| 57 |
approveButtonColor: PropTypes.string, |
| 58 |
approveButtonTarget: PropTypes.string, |
| 59 |
approveButtonRef: PropTypes.object, |
| 60 |
}; |
| 61 |
|
| 62 |
Dialog.defaultProps = {}; |
| 63 |
|
| 64 |
Dialog.Wrapper = DialogWrapper; |
| 65 |
Dialog.Content = DialogContent; |
| 66 |
Dialog.Title = DialogTitle; |
| 67 |
Dialog.Text = DialogText; |
| 68 |
Dialog.Actions = DialogActions; |
| 69 |
Dialog.Button = DialogButton; |
| 70 |
|