@bigfishtv/cockpit
Version:
32 lines (28 loc) • 670 B
JavaScript
import React, { Component } from 'react'
import Modal from '../modal/Modal'
export default class PromptModal extends Component {
static defaultProps = {
title: 'Warning',
style: 'primary',
callback: () => console.warn('[PromptModal] no callback prop'),
}
handleCallback = (...results) => {
this.props.callback(...results)
this.props.closeModal()
}
render() {
const { title, message, style, Buttons } = this.props
return (
<Modal
{...this.props}
size="xsmall"
title={title}
callback={this.handleCallback}
style={style}
onClose={() => this.props.closeModal()}
ModalActions={Buttons}>
{message}
</Modal>
)
}
}