Skip to content

Commit

Permalink
Merge pull request #497 from cornell-dti/nd433/otherChange
Browse files Browse the repository at this point in the history
Add Needs entry to student when selecting "other"
  • Loading branch information
Atikpui007 authored Sep 20, 2024
2 parents cae6ac0 + 90291c8 commit e573ae0
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions frontend/src/components/Modal/RiderModalInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useState } from 'react';
import { useForm } from 'react-hook-form';
import cn from 'classnames';
import { Button, Input, Label } from '../FormElements/FormElements';
Expand Down Expand Up @@ -63,7 +63,7 @@ const RiderModalInfo = ({
const localUserType = localStorage.getItem('userType');
const isEditing = rider !== undefined;
const isStudentEditing = isEditing && localUserType === 'Rider';

const [needsOption, setNeedsOption] = useState('');
return (
<form onSubmit={handleSubmit(beforeSubmit)} className={styles.form}>
<div className={cn(styles.inputContainer, styles.rideTime)}>
Expand Down Expand Up @@ -139,6 +139,7 @@ const RiderModalInfo = ({
name="needs"
aria-required="true"
ref={register({ required: true })}
onChange={(e) => setNeedsOption(e.target.value)}
>
{Object.values(Accessibility).map((value, index) => {
return (
Expand All @@ -148,6 +149,16 @@ const RiderModalInfo = ({
);
})}
</select>
{needsOption == 'Other' ? (
<Input
id="otherNeeds"
name="otherNeeds"
type="text"
placeholder="Please Specify Needs"
></Input>
) : (
<></>
)}
{errors.needs?.type === 'validate' && (
<p className={styles.error}>
Invalid needs. You can enter 'Assistant', 'Crutches', or
Expand Down

0 comments on commit e573ae0

Please sign in to comment.