import { h, Component, createRef } from 'preact'; class WBDialog extends Component { constructor(...args) { super(...args); this.modalRef = createRef(); } show() { $(this.modalRef.current).modal(); } hide() { $(this.modalRef.current).modal('hide'); } componentWillUnmount() { $(this.modalRef.current).modal('hide'); } render({ title, children, canAccept, accept, reject }) { return (
); } } WBDialog.defaultProps = { title: 'Dialog', accept: () => {}, reject: () => {}, canAccept: () => true }; export default WBDialog;