add
This commit is contained in:
parent
128296b675
commit
5870d104af
|
@ -41,6 +41,11 @@ const InfoCard: React.FC<InfoCardProps> = ({ onAdd, onHeightChange }) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleDelete = (index: number) => {
|
||||||
|
const newContents = addedContents.filter((_, i) => i !== index);
|
||||||
|
setAddedContents(newContents);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-center mb-3 w-full">
|
<div className="flex items-center mb-3 w-full">
|
||||||
|
@ -65,9 +70,16 @@ const InfoCard: React.FC<InfoCardProps> = ({ onAdd, onHeightChange }) => {
|
||||||
{addedContents.map((item, index) => (
|
{addedContents.map((item, index) => (
|
||||||
<div
|
<div
|
||||||
key={index}
|
key={index}
|
||||||
className="p-2 border border-gray-200 rounded bg-gray-50 mb-2 last:mb-0"
|
className="flex justify-between items-center p-2 border border-gray-200 rounded bg-gray-50 mb-2 last:mb-0"
|
||||||
>
|
>
|
||||||
{item}
|
<span>{item}</span>
|
||||||
|
<Button
|
||||||
|
type="text"
|
||||||
|
onClick={() => handleDelete(index)}
|
||||||
|
className="text-red-500"
|
||||||
|
>
|
||||||
|
X
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue