mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-05-25 11:09:11 +00:00
26 lines
467 B
JavaScript
26 lines
467 B
JavaScript
import { React } from "react";
|
|
import { useDrag } from "react-dnd";
|
|
|
|
export default function Shape() {
|
|
const [{ isDragging }, drag] = useDrag(() => ({
|
|
type: "CARD",
|
|
collect: (monitor) => ({
|
|
isDragging: !!monitor.isDragging(),
|
|
}),
|
|
}));
|
|
|
|
return (
|
|
<div
|
|
ref={drag}
|
|
style={{
|
|
opacity: isDragging ? 0.5 : 1,
|
|
fontSize: 25,
|
|
fontWeight: "bold",
|
|
cursor: "move",
|
|
}}
|
|
>
|
|
rect
|
|
</div>
|
|
);
|
|
}
|