dynamically remove fields to tables

This commit is contained in:
1ilit 2023-09-19 15:47:19 +03:00
parent 67073eaba0
commit cc1a73d6dd

View File

@ -36,7 +36,7 @@ const Rect = (props) => {
name: "Students", name: "Students",
}; };
const height = fields.length * 36 + (fields.length - 1) * 2 + 40 + 2; const height = fields.length * 36 + 40 + 2;
return ( return (
<g> <g>
@ -114,7 +114,14 @@ const Rect = (props) => {
<button className="btn bg-sky-800 text-white text-xs py-1 px-2 me-2 opacity-80"> <button className="btn bg-sky-800 text-white text-xs py-1 px-2 me-2 opacity-80">
<IconEdit /> <IconEdit />
</button> </button>
<button className="btn bg-red-800 text-white text-xs py-1 px-2 opacity-80"> <button
className="btn bg-red-800 text-white text-xs py-1 px-2 opacity-80"
onClick={(e) => {
const updatedFields = [...fields];
updatedFields.splice(i, 1);
setFields(updatedFields);
}}
>
<IconMinus /> <IconMinus />
</button> </button>
</div> </div>