Created
October 7, 2024 20:16
-
-
Save brdsio/42ede3cbf883df8ec5485cd73559a6f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Button, Form, Table } from "react-bootstrap"; | |
import { Vaccines } from "@/types/vaccines"; | |
interface VaccineTableProps { | |
vaccineRows: Vaccines[]; | |
handleVaccineChange: (index: number, field: keyof Vaccines, value: string) => void; | |
handleAddVaccineRow: () => void; | |
} | |
export default function VaccineTable({ | |
vaccineRows, | |
handleVaccineChange, | |
handleAddVaccineRow | |
}: VaccineTableProps) { | |
return ( | |
<> | |
<Table striped bordered hover size="sm"> | |
<thead> | |
<tr> | |
<th></th> | |
<th>Aplicada em</th> | |
<th>Replicar em</th> | |
</tr> | |
</thead> | |
<tbody> | |
{vaccineRows.map((row, index) => ( | |
<tr key={index}> | |
<td> | |
<Form.Control | |
placeholder={row.vaccine} | |
onChange={(e) => handleVaccineChange(index, 'vaccine', e.target.value)} | |
/> | |
</td> | |
<td> | |
<Form.Control | |
placeholder="dd/mm/aaaa" | |
defaultValue={row.appliedDate} | |
onChange={(e) => handleVaccineChange(index, 'appliedDate', e.target.value)} | |
/> | |
</td> | |
<td> | |
<Form.Control | |
placeholder="dd/mm/aaaa" | |
defaultValue={row.replicateDate} | |
onChange={(e) => handleVaccineChange(index, 'replicateDate', e.target.value)} | |
/> | |
</td> | |
</tr> | |
))} | |
</tbody> | |
</Table> | |
<Button variant="outline-dark" onClick={handleAddVaccineRow}> | |
Adicionar nova vacina | |
</Button> | |
</> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment