0902579fbe
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Co-authored-by: Devessier <baptiste@devessier.fr>
26 lines
886 B
TypeScript
26 lines
886 B
TypeScript
import { Droppable, type DroppableProvided } from '@hello-pangea/dnd';
|
|
import { type ReactNode, useContext } from 'react';
|
|
|
|
import { ADD_TO_NAV_SOURCE_DROPPABLE_ID } from '@/navigation-menu-item/constants/AddToNavSourceDroppableId';
|
|
import { NavigationDragSourceContext } from '@/navigation-menu-item/contexts/NavigationDragSourceContext';
|
|
|
|
type CommandMenuAddToNavDroppableProps = {
|
|
children: (provided: DroppableProvided) => ReactNode;
|
|
};
|
|
|
|
export const CommandMenuAddToNavDroppable = ({
|
|
children,
|
|
}: CommandMenuAddToNavDroppableProps) => {
|
|
const { sourceDroppableId } = useContext(NavigationDragSourceContext);
|
|
const isDropDisabled = sourceDroppableId === ADD_TO_NAV_SOURCE_DROPPABLE_ID;
|
|
|
|
return (
|
|
<Droppable
|
|
droppableId={ADD_TO_NAV_SOURCE_DROPPABLE_ID}
|
|
isDropDisabled={isDropDisabled}
|
|
>
|
|
{(provided) => children(provided)}
|
|
</Droppable>
|
|
);
|
|
};
|