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, onClose: PropTypes.func, // 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, onClose, onSubmit, submitType, submitText, onCancel, cancelType, cancelText, } = this.props return (
{ headerText && (
{ headerText }
) }
{ children }
{ onCancel && ( ) }
) } }