Function
SortableItem
({
id,
children,
className,
}: {
id: string
children: ReactNode
className?: string
})
Source from the content-addressed store, hash-verified
| 63 | } |
| 64 | |
| 65 | export function SortableItem({ |
| 66 | id, |
| 67 | children, |
| 68 | className, |
| 69 | }: { |
| 70 | id: string |
| 71 | children: ReactNode |
| 72 | className?: string |
| 73 | }) { |
| 74 | const { |
| 75 | setNodeRef, |
| 76 | transform, |
| 77 | transition, |
| 78 | activeIndex, |
| 79 | index, |
| 80 | attributes, |
| 81 | listeners, |
| 82 | } = useSortable({ id }) |
| 83 | const isActive = activeIndex === index |
| 84 | |
| 85 | return ( |
| 86 | <div |
| 87 | ref={setNodeRef} |
| 88 | style={{ |
| 89 | transform: CSS.Transform.toString(transform), |
| 90 | transition, |
| 91 | }} |
| 92 | className={cn( |
| 93 | "flex gap-1 items-center bg-background rounded-lg p-2", |
| 94 | isActive && "z-10 border shadow-md" |
| 95 | )} |
| 96 | > |
| 97 | <GripVerticalIcon |
| 98 | className="text-muted-foreground size-6 p-1" |
| 99 | {...attributes} |
| 100 | {...listeners} |
| 101 | /> |
| 102 | <div className={cn("flex-grow", className)}>{children}</div> |
| 103 | </div> |
| 104 | ) |
| 105 | } |
Callers
nothing calls this directly
Tested by
no test coverage detected