diff --git a/frontend/src/components/shared/ConfirmMenuButton.tsx b/frontend/src/components/shared/ConfirmMenuButton.tsx new file mode 100644 index 000000000..051c07d38 --- /dev/null +++ b/frontend/src/components/shared/ConfirmMenuButton.tsx @@ -0,0 +1,80 @@ +import { Component, createSignal, JSX } from "solid-js"; +import { pushNotification } from "../.."; +import { useToggle } from "../../util/hooks"; +import ConfirmButton from "./ConfirmButton"; +import Input from "./Input"; +import Grid from "./layout/Grid"; +import CenterMenu from "./menu/CenterMenu"; + +const ConfirmMenuButton: Component<{ + onConfirm?: () => void; + class?: string; + style?: JSX.CSSProperties; + title: string; + match: string; + children: JSX.Element; +}> = (p) => { + const [show, toggleShow] = useToggle(); + + return ( + { + e.stopPropagation(); + toggleShow(); + }} + > + {p.children} + + } + content={() => ( + + )} + position="center" + /> + ); +}; + +const ConfirmMenuContent: Component<{ + class?: string; + title: string; + match: string; + onConfirm?: () => void; +}> = (p) => { + const [input, setInput] = createSignal(""); + return ( + + + { + if (input() === p.match) { + p.onConfirm && p.onConfirm(); + } else { + pushNotification("bad", "must enter value to confirm"); + } + }} + > + {p.title} + + + ); +}; + +export default ConfirmMenuButton;