mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
11 lines
395 B
TypeScript
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 };
|
|
};
|