import React from 'react'; import Button from '../../libs/Button'; import './index.less' class Dialog extends React.PureComponent { state = { visible: this.props.visible, } componentWillReceiveProps(nextProps) { if (nextProps.visible !== this.props.visible) { this.setState({ visible: nextProps.visible, }); }; } confirm = () => { const { onConfirm, } = this.props; if (onConfirm) { onConfirm(); }; } cancel = () => { const { onCancel, } = this.props; if (onCancel) { onCancel(); }; } render() { const { title, children, onCancel, onConfirm, } = this.props; const { visible, } = this.state; const fade = visible ? 'wowjoy-dialog__fadeIn' : ''; return (