/* eslint-disable react/jsx-handler-names */ /* @flow */ 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 DialogStatus = () => { const [infoAlertOpened, toggleInfoAlert] = useDialog() const [cautionAlertOpened, toggleCautionAlert] = useDialog() const [successAlertOpened, toggleSuccessAlert] = useDialog() const [errorAlertOpened, toggleErrorAlert] = useDialog() const [deleteAlertOpened, toggleDeleteAlert] = useDialog() const dialogs = [ { status: "info", text: "Text explaining why there is an alert", title: "Are you Sure?", toggle: toggleInfoAlert, visible: infoAlertOpened, buttonOneText:"No, Cancel", buttonTwoText: "Yes, Action" }, { status: "caution", text: "This is the action you will be taking", title: "Are you Sure?", toggle: toggleCautionAlert, visible: cautionAlertOpened, buttonOneText:"No, Cancel", buttonTwoText: "Yes, Action" }, { status: "delete", text: "You are about to delete ...", title: "Delete", toggle: toggleDeleteAlert, visible: deleteAlertOpened, buttonOneText:"No, Cancel", buttonTwoText: "Yes, Delete" }, { status: "error", text: "Text explaining the error", title: "Error Message", toggle: toggleErrorAlert, visible: errorAlertOpened, buttonOneText:"No, Cancel", buttonTwoText: "Ok, Thanks" }, { status: "success", text: "Text explaining what is successful", title: "Success!", toggle: toggleSuccessAlert, visible: successAlertOpened, buttonOneText:"No, Cancel", buttonTwoText: "Ok, Thanks" }, ] return (