PHP 7.4.33
Preview: ConfirmationDialog.js Size: 1.42 KB
/var/www/web-koncept/client/src/components/compound/ConfirmationDialog.js
import React from 'react';
import "../../assets/styles/pages/ConfirmationDialog.scss";
import PropTypes from 'prop-types';
import { confirmable } from 'react-confirm';
import { AiOutlineClose } from 'react-icons/ai';

const ConfirmationDialog = ({ show, proceed, cancel, confirmation }) => {
    const handleKeyUp = (e) => {
        if (e.key === 'Escape') {
            cancel();
        }
    };
    if (!show) {
        return null;
    }

    return (
        <div className={`cd-popup ${show ? 'is-visible' : ''}`} role="alert" onClick={cancel} onKeyUp={handleKeyUp}>
            <div className="cd-popup-container" onClick={(e) => e.stopPropagation()}>
                <p>{confirmation}</p>
                <ul className="cd-buttons">
                    <li>
                        <button type="button" onClick={proceed}>Yes</button>
                    </li>
                    <li>
                        <button type="button" onClick={cancel}>No</button>
                    </li>
                </ul>
                <button className="cd-popup-close img-replace" onClick={cancel}>
                    <AiOutlineClose size={20} />
                </button>
            </div>
        </div>
    );
};

ConfirmationDialog.propTypes = {
    show: PropTypes.bool,
    proceed: PropTypes.func,
    cancel: PropTypes.func,
    confirmation: PropTypes.string,
    options: PropTypes.object
}

export default confirmable(ConfirmationDialog);

Directory Contents

Dirs: 0 × Files: 9
Name Size Perms Modified Actions
1.42 KB lrw-r--r-- 2024-11-04 12:03:48
Edit Download
1.24 KB lrw-r--r-- 2024-11-05 04:29:08
Edit Download
1016 B lrw-r--r-- 2024-11-04 12:03:48
Edit Download
257 B lrw-r--r-- 2024-11-04 12:03:48
Edit Download
1.26 KB lrw-r--r-- 2024-11-05 04:29:08
Edit Download
2.68 KB lrw-r--r-- 2024-11-06 05:16:11
Edit Download
235 B lrw-r--r-- 2024-11-04 12:03:48
Edit Download
443 B lrw-r--r-- 2024-11-04 12:03:48
Edit Download
1.12 KB lrw-r--r-- 2024-11-04 12:03:48
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).