drawDB/src/components/rect.jsx

31 lines
804 B
React
Raw Normal View History

2023-09-19 20:47:06 +08:00
import React from "react";
2023-09-19 20:47:10 +08:00
import { Button } from "@arco-design/web-react";
2023-09-19 20:47:06 +08:00
const Rect = (props) => {
return (
<g>
2023-09-19 20:47:10 +08:00
<foreignObject
2023-09-19 20:47:06 +08:00
key={props.id}
x={props.x}
y={props.y}
width={props.width}
height={props.height}
style={{ fill: "blue", cursor: "move" }}
onMouseDown={props.onMouseDown}
2023-09-19 20:47:10 +08:00
>
<div xmlns="http://www.w3.org/1999/xhtml" className="bg-blue p-3">
<div className="text-white">{props.label}</div>
2023-09-19 20:47:08 +08:00
<form onSubmit={(e) => e.preventDefault()}>
<input type="text" className="w-full" />
</form>
2023-09-19 20:47:10 +08:00
<Button type="secondary" onClick={(e) => console.log("sup")}>
sup
</Button>
</div>
2023-09-19 20:47:08 +08:00
</foreignObject>
2023-09-19 20:47:06 +08:00
</g>
);
};
export default Rect;