Sha256: 546d7d9abc3b3bbb8aa9269716a9c3a0110e00144b5bb195252e3fc928bbb410
Contents?: true
Size: 905 Bytes
Versions: 15
Compression:
Stored size: 905 Bytes
Contents
import React from "react"; import PropTypes from "prop-types"; export default function DragElement(props) { const { draggable, dragState, container } = props; if (draggable === "Files") { return ""; } else { const containerSize = container.current.getBoundingClientRect(); const x = dragState.x - (containerSize.x || containerSize.left); const y = dragState.y - (containerSize.y || containerSize.top); const translateStyle = { transform: `translate3d(${x}px, ${y}px, 0)` }; return ( <div className="drag-image" style={translateStyle}> {draggable.record.image && ( <img src={draggable.record.src || draggable.record.image.thumbnail_url} /> )} </div> ); } } DragElement.propTypes = { draggable: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), dragState: PropTypes.object, container: PropTypes.object };
Version data entries
15 entries across 15 versions & 1 rubygems