add ability to move cards
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
import { useDndContext } from "@dnd-kit/core"
|
||||
import { useSortable } from "@dnd-kit/sortable"
|
||||
import { CSS } from "@dnd-kit/utilities"
|
||||
import { Pencil } from "lucide-react"
|
||||
@@ -85,6 +86,8 @@ export function LinkTile({
|
||||
link: HomeLink
|
||||
onEdit: () => void
|
||||
}) {
|
||||
// while a card is dragged, the arrow keys go from card to card, not through the links
|
||||
const cardDragged = !!useDndContext().active?.data.current?.card
|
||||
const {
|
||||
attributes,
|
||||
listeners,
|
||||
@@ -92,7 +95,7 @@ export function LinkTile({
|
||||
transform,
|
||||
transition,
|
||||
isDragging,
|
||||
} = useSortable({ id: link.id })
|
||||
} = useSortable({ id: link.id, disabled: { droppable: cardDragged } })
|
||||
return (
|
||||
<div
|
||||
ref={setNodeRef}
|
||||
|
||||
Reference in New Issue
Block a user