| | |
| | | import { Icon, Popover, Button } from 'antd' |
| | | import './index.scss' |
| | | |
| | | const Card = ({ id, cardIds, card, moveCard, findCard, editCard, delCard, profileCard, changeStyle, doubleClickCard }) => { |
| | | const Card = ({ id, card, moveCard, findCard, editCard, delCard, profileCard, changeStyle, doubleClickCard }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: 'action', id, originalIndex }, |
| | |
| | | accept: 'action', |
| | | canDrop: () => true, |
| | | drop({ id: draggedId }) { |
| | | if (!draggedId) return |
| | | if (!cardIds.includes(draggedId)) return |
| | | if (!draggedId || draggedId === id) return |
| | | |
| | | if (draggedId !== id) { |
| | | const { index: overIndex } = findCard(id) |
| | | moveCard(draggedId, overIndex) |
| | | } |
| | | const { index: originIndex } = findCard(draggedId) |
| | | if (originIndex === -1) return |
| | | |
| | | const { index: overIndex } = findCard(id) |
| | | moveCard(draggedId, overIndex) |
| | | }, |
| | | }) |
| | | |