Compare commits
2 Commits
d8d2e9f8e4
...
9685d94b96
Author | SHA1 | Date |
---|---|---|
|
9685d94b96 | |
|
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 (
|
||||
<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>
|
||||
|
|
Loading…
Reference in New Issue