kanban-app/frontend/src/components/kanban/SortableKanbanColumn.tsx

26 lines
698 B
TypeScript
Raw Normal View History

2026-02-27 20:26:25 +00:00
import { useDraggable } from '@dnd-kit/core';
import { KanbanColumn, KanbanColumnProps } from './KanbanColumn';
export function SortableKanbanColumn(props: KanbanColumnProps) {
const { attributes, listeners, setNodeRef, transform, isDragging } = useDraggable({
id: `COLUMN_${props.list.id}`,
data: {
type: 'column',
columnId: props.list.id,
},
});
const style = transform
? {
transform: `translate3d(${transform.x}px, ${transform.y}px, 0)`,
opacity: isDragging ? 0.5 : 1,
}
: undefined;
return (
<div ref={setNodeRef} style={style}>
<KanbanColumn {...props} dragHandleProps={{ attributes, listeners }} />
</div>
);
}