Compare commits

...

2 Commits

Author SHA1 Message Date
Li1304553726 9685d94b96 Merge branch 'main' of http://113.45.157.195:3003/linfeng/staff_data 2025-03-26 13:07:24 +08:00
Li1304553726 5870d104af add 2025-03-26 13:07:23 +08:00
1 changed files with 14 additions and 2 deletions

View File

@ -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 (
<div className="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) => (
<div
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>