Skip to content

Commit

Permalink
also passes all lints...
Browse files Browse the repository at this point in the history
  • Loading branch information
chennisden committed Jul 26, 2024
1 parent 20d568f commit fc15b74
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion frontend/src/components/ListingForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ const ListingForm: React.FC<ListingFormProps> = ({
setArtifacts(newImages);
};

const handleChildrenChange = (
index: number,
e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,
) => {
const { value } = e.target;
const newChildren = [...child_ids];
newChildren[index] = value;
setChildIds(newChildren);
};

return (
<>
<h1>{title}</h1>
Expand Down Expand Up @@ -129,7 +139,16 @@ const ListingForm: React.FC<ListingFormProps> = ({
<h2>Children</h2>
{child_ids.map((id, index) => (
<Row key={index} className="mb-3">
{id}
<label htmlFor={"child-" + index}>Part</label>
<Form.Control
id={"child-" + index}
className="mb-1"
as="select"
name="child_id"
value={id}
onChange={(e) => handleChildrenChange(index, e)}
required
></Form.Control>
</Row>
))}
<Col md={12}>
Expand Down

0 comments on commit fc15b74

Please sign in to comment.