diff --git a/packages/strapi-helper-plugin/lib/src/components/PopUpWarning/index.js b/packages/strapi-helper-plugin/lib/src/components/PopUpWarning/index.js index daf2c87ace..42fc2638eb 100644 --- a/packages/strapi-helper-plugin/lib/src/components/PopUpWarning/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/PopUpWarning/index.js @@ -6,6 +6,7 @@ import React from 'react'; import PropTypes from 'prop-types'; +import { map } from 'lodash'; // modal import { Button, Modal, ModalHeader, ModalBody } from 'reactstrap'; @@ -17,54 +18,66 @@ import IcoSuccess from '../../assets/icons/icon_success.svg'; import IcoWarning from '../../assets/icons/icon_warning.svg'; import styles from './styles.scss'; -class PopUpWarning extends React.Component { // eslint-disable-line react/prefer-stateless-function - constructor(props) { - super(props); +const icons = { + 'danger': IcoDanger, + 'info': IcoInfo, + 'notFound': IcoNotFound, + 'success': IcoSuccess, + 'warning': IcoWarning, +}; - this.icons = { - 'danger': IcoDanger, - 'info': IcoInfo, - 'notFound': IcoNotFound, - 'success': IcoSuccess, - 'warning': IcoWarning, - }; - } +function PopUpWarning({ content, isOpen, onConfirm, onlyConfirmButton, popUpWarningType, toggleModal }) { + const buttons = [ + { + className: styles.secondary, + id: content.cancel || 'components.popUpWarning.button.cancel', + handleClick: toggleModal, + style: {}, + }, + { + className: styles.primary, + id: content.confirm || 'components.popUpWarning.button.confirm', + handleClick: onConfirm, + style: {}, + }, + ]; + const singleButton = [ + { + className: styles.primary, + id: content.confirm || 'components.popUpWarning.button.confirm', + handleClick: onConfirm, + style: { width: '100%' }, + }, + ]; + const footerButtons = onlyConfirmButton ? singleButton : buttons; - render() { - return ( -
{message}
- )} + return ( +{message}
+ )} +