import { createContext, useContext, useState } from 'react';
type DragContextType = {
draggedId: string | null;
setDraggedId: (id: string | null) => void;
};
const DragContext = createContext<DragContextType>({
draggedId: null,
setDraggedId: () => {},
});
export function DragProvider({ children }: { children: React.ReactNode }) {
const [draggedId, setDraggedId] = useState<string | null>(null);
return (
<DragContext.Provider value={{ draggedId, setDraggedId }}>
{children}
</DragContext.Provider>
);
}
export const useDragContext = () => useContext(DragContext);