/* eslint-disable react/jsx-handler-names */ import React, { useState } from "react" import { Button, Dialog, Flex} from "../.." const useDialog = (visible = false) => { const [opened, setOpened] = useState(visible) const toggle = () => setOpened(!opened) return [opened, toggle] } const DialogStackedAlert = () => { const [defaultAlertOpened, toggleDefaultAlert] = useDialog() const [cautionAlertOpened, toggleCautionAlert] = useDialog() const [deleteAlertOpened, toggleDeleteAlert] = useDialog() const dialogs = [ { size: "sm", status: "default", text: "Text explaining why there is an alert", title: "Are you sure?", toggle: toggleDefaultAlert, visible: defaultAlertOpened, buttonOneText:"Yes, Action", buttonTwoText: "No, Cancel" }, { size: "sm", status: "caution", text: "This is the action you will be taking", title: "Are you sure?", toggle: toggleCautionAlert, visible: cautionAlertOpened, buttonOneText:"Yes, Action", buttonTwoText: "No, Cancel" }, { size: "sm", status: "delete", text: "You are about to delete ...", title: "Delete", toggle: toggleDeleteAlert, visible: deleteAlertOpened, buttonOneText:"Yes, Delete", buttonTwoText: "No, Cancel" } ] return (
{dialogs.map((dialog) => ( ))}
) } export default DialogStackedAlert