tasko/hooks/use-card-modal.ts
2024-02-15 20:49:19 -05:00

15 lines
363 B
TypeScript

import { create } from 'zustand';
type CardModalStore = {
id?: string;
isOpen: boolean;
onOpen: (id: string) => void;
onClose: () => void;
};
export const useCardModal = create<CardModalStore>((set) => ({
id: undefined,
isOpen: false,
onOpen: (id: string) => set({ isOpen: true, id }),
onClose: () => set({ isOpen: false, id: undefined }),
}));