import React from 'react';
import Popup from './popup';
import Button from './button';

const Confirmation = ({message, onConfirm}: {message: string, onConfirm: (confirmed: boolean) => void}) => {
    return <Popup removePopup={() => onConfirm(false)}>
        <div className="flex flex-col gap-2 items-center justify-center w-full p-3 transparent-inner">
            <h3>{message || 'Are you sure?'}</h3>
            <div className="flex gap-2 items-center justify-center w-full">
                <Button warn className="grow p-5" onClick={() => {
                    onConfirm(false)
                }}>No</Button>
                <Button className="grow p-5" onClick={() => {
                    onConfirm(true)
                }}>Yes</Button>
            </div>
        </div>
    </Popup>
}

export default React.memo(Confirmation);