import React from 'react'; import { useSortable } from '@dnd-kit/sortable'; import { CSS } from '@dnd-kit/utilities'; import { GripVertical, FolderOpen } from 'lucide-react'; import * as LucideIcons from 'lucide-react'; import clsx from 'clsx'; interface SortableMenuItemProps { id: string; label: string; icon: string; isGroup?: boolean; } function getIcon(name: string): React.ReactNode { const Icon = (LucideIcons as any)[name]; return Icon ? : ; } export function SortableMenuItem({ id, label, icon, isGroup }: SortableMenuItemProps) { const { attributes, listeners, setNodeRef, transform, transition, isDragging, } = useSortable({ id }); const style = { transform: CSS.Transform.toString(transform), transition, }; return (
{isGroup ? : getIcon(icon)} {isGroup && {label}} {!isGroup && label}
); }