Files
ProjectE/apps/web/lib/stores/use-create-dialog-store.ts
T

18 lines
448 B
TypeScript
Raw Normal View History

import { create } from "zustand";
type ItemType = "task" | "project" | "habit" | null;
interface CreateDialogState {
type: ItemType;
open: boolean;
openCreate: (type: ItemType) => void;
closeCreate: () => void;
}
export const useCreateDialogStore = create<CreateDialogState>((set) => ({
type: null,
open: false,
openCreate: (type: ItemType) => set({ type, open: true }),
closeCreate: () => set({ type: null, open: false }),
}));