aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/modal/modal.component.js
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@gmail.com>2018-09-18 00:56:59 +0800
committerAlexander Tseung <alextsg@gmail.com>2018-09-20 05:31:10 +0800
commitd0d0103bb52cbc032a3b3ea2a2ff5edbf67b0d19 (patch)
treedb5d0296800d1844215c006b8c937d95c1c683b7 /ui/app/components/modal/modal.component.js
parent44d4b5b5db021646ca26026d91ab2ef39153af37 (diff)
downloadtangerine-wallet-browser-d0d0103bb52cbc032a3b3ea2a2ff5edbf67b0d19.tar.gz
tangerine-wallet-browser-d0d0103bb52cbc032a3b3ea2a2ff5edbf67b0d19.tar.zst
tangerine-wallet-browser-d0d0103bb52cbc032a3b3ea2a2ff5edbf67b0d19.zip
Add Modal component
Diffstat (limited to 'ui/app/components/modal/modal.component.js')
-rw-r--r--ui/app/components/modal/modal.component.js78
1 files changed, 78 insertions, 0 deletions
diff --git a/ui/app/components/modal/modal.component.js b/ui/app/components/modal/modal.component.js
new file mode 100644
index 000000000..81bdd0010
--- /dev/null
+++ b/ui/app/components/modal/modal.component.js
@@ -0,0 +1,78 @@
+import React, { PureComponent } from 'react'
+import PropTypes from 'prop-types'
+import Button from '../button'
+
+export default class Modal extends PureComponent {
+ static propTypes = {
+ children: PropTypes.node,
+ // Header text
+ headerText: PropTypes.string,
+ // Submit button (right button)
+ onSubmit: PropTypes.func,
+ submitType: PropTypes.string,
+ submitText: PropTypes.string,
+ // Cancel button (left button)
+ onCancel: PropTypes.func,
+ cancelType: PropTypes.string,
+ cancelText: PropTypes.string,
+ }
+
+ static defaultProps = {
+ submitType: 'primary',
+ cancelType: 'default',
+ }
+
+ render () {
+ const {
+ children,
+ headerText,
+ onSubmit,
+ submitType,
+ submitText,
+ onCancel,
+ cancelType,
+ cancelText,
+ } = this.props
+
+ return (
+ <div className="modal-container">
+ {
+ headerText && (
+ <div className="modal-container__header">
+ <div className="modal-container__header-text">
+ { headerText }
+ </div>
+ <div
+ className="modal-container__header-close"
+ onClick={() => onCancel()}
+ />
+ </div>
+ )
+ }
+ <div className="modal-container__content">
+ { children }
+ </div>
+ <div className="modal-container__footer">
+ {
+ onCancel && (
+ <Button
+ type={cancelType}
+ onClick={onCancel}
+ className="modal-container__footer-button"
+ >
+ { cancelText }
+ </Button>
+ )
+ }
+ <Button
+ type={submitType}
+ onClick={onSubmit}
+ className="modal-container__footer-button"
+ >
+ { submitText }
+ </Button>
+ </div>
+ </div>
+ )
+ }
+}