'use client'; import React from 'react'; import { useSortable } from '@dnd-kit/sortable'; import { CSS } from '@dnd-kit/utilities'; import { GripVertical } from 'lucide-react'; interface DraggableSectionWrapperProps { id: string; children: React.ReactNode; disabled?: boolean; } /** * DraggableSectionWrapper Component * * Wraps resume sections to make them draggable using @dnd-kit. * Provides: * - Drag handle (grip icon) for initiating drag operations * - Visual feedback during drag (opacity, cursor) * - Keyboard accessibility for drag operations * - Swiss International Style aesthetic (square corners, high contrast) */ export const DraggableSectionWrapper: React.FC = ({ id, children, disabled = false, }) => { const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id, disabled, }); const style = { transform: CSS.Transform.toString(transform), transition, opacity: isDragging ? 0.5 : 1, }; return (
{/* Drag Handle */} {!disabled && (
)} {/* Section Content - add left padding to make room for drag handle */}
{children}
); };