Files
pterodactyl-panel/resources/scripts/components/elements/dialog/useDialogState.ts
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

11 lines
395 B
TypeScript

import { useCallback, useState } from 'react';
export const useDialogState = (initialOpen = false) => {
const [open, setOpen] = useState(initialOpen);
const show = useCallback(() => setOpen(true), []);
const hide = useCallback(() => setOpen(false), []);
const toggle = useCallback(() => setOpen((current) => !current), []);
return { open, setOpen, show, hide, toggle };
};