| | |
| | | import ItemTypes from './itemtypes' |
| | | import './index.scss' |
| | | |
| | | const Card = ({ id, type, card, moveCard, findCard, editCard, hasDrop }) => { |
| | | const Card = ({ id, type, card, moveCard, findCard, editCard, copyCard, hasDrop }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: ItemTypes[type], id, originalIndex }, |
| | |
| | | const edit = () => { |
| | | editCard(id) |
| | | } |
| | | |
| | | const copy = () => { |
| | | copyCard(id) |
| | | } |
| | | |
| | | return ( |
| | | <div className="page-card" style={type === 'columns' ? { flex: card.Width, opacity: opacity} : { opacity: opacity}}> |
| | | <div ref={node => drag(drop(node))}> |
| | |
| | | } |
| | | </div> |
| | | <Icon className="edit" type="edit" onClick={edit} /> |
| | | {type === 'action' && <Icon className="edit copy" type="copy" onClick={copy} />} |
| | | </div> |
| | | ) |
| | | } |