import React, { Component } from 'react'; import { defineMessages } from 'react-intl'; import { withModalMounter } from '/imports/ui/components/common/modal/service'; import PropTypes from 'prop-types'; import Styled from './styles'; const messages = defineMessages({ yesLabel: { id: 'app.endMeeting.yesLabel', description: 'confirm button label', }, noLabel: { id: 'app.endMeeting.noLabel', description: 'cancel confirm button label', }, }); const propTypes = { confirmButtonColor: PropTypes.string, disableConfirmButton: PropTypes.bool, description: PropTypes.string, }; const defaultProps = { confirmButtonColor: 'primary', disableConfirmButton: false, description: '', }; class ConfirmationModal extends Component { constructor(props) { super(props); this.state = { checked: false, }; } render() { const { intl, mountModal, onConfirm, title, titleMessageId, titleMessageExtra, checkboxMessageId, confirmButtonColor, confirmButtonDataTest, confirmParam, disableConfirmButton, description, } = this.props; const { checked, } = this.state; const hasCheckbox = !!checkboxMessageId; return ( mountModal(null)} hideBorder contentLabel={title} > { title || intl.formatMessage({ id: titleMessageId }, { 0: titleMessageExtra })} { hasCheckbox ? ( ) : null } { onConfirm(confirmParam, checked); mountModal(null); }} /> mountModal(null)} /> ); } } ConfirmationModal.propTypes = propTypes; ConfirmationModal.defaultProps = defaultProps; export default withModalMounter(ConfirmationModal);