ConfirmationDialog.jsx 1.21 KB
Newer Older
Giang Tran committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
import React from 'react'
import { Dialog, Button } from '@material-ui/core'

const ConfirmationDialog = ({
    open,
    onConfirmDialogClose,
    text,
    title = 'confirm',
    onYesClick,
}) => {
    return (
        <Dialog maxWidth="xs" open={open} onClose={onConfirmDialogClose}>
            <div className="p-8 text-center w-360 mx-auto">
                <h4 className="capitalize m-0 mb-2">{title}</h4>
                <p>{text}</p>
                <div className="flex justify-center pt-2 m--2">
                    <Button
                        className="m-2 rounded hover-bg-primary px-6"
                        variant="outlined"
                        color="primary"
                        onClick={onYesClick}
                    >
                        Yes
                    </Button>
                    <Button
                        className="m-2 rounded hover-bg-secondary px-6"
                        variant="outlined"
                        color="secondary"
                        onClick={onConfirmDialogClose}
                    >
                        No
                    </Button>
                </div>
            </div>
        </Dialog>
    )
}

export default ConfirmationDialog