Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
kingyau991319 committed Jun 11, 2022
1 parent 5a1a32d commit 51ce802
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// the type of the input element
export type InputType = 'name' | 'age' | 'email' | 'phone' | 'remark';
export type InputType = 'name' | 'age' | 'email' | 'phone' | 'remark' | 'gender';
4 changes: 2 additions & 2 deletions src/components/NewResv/Form/PersonInfo/Person.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Remark from './TextInputElement/Remark';
import Gender from './TextInputElement/Gender';

// Interface
import { PersonData, PhoneData } from './Interface/PersonData';
import { GenderType, PersonData, PhoneData } from './Interface/PersonData';

const Person =
(props : {
Expand Down Expand Up @@ -70,7 +70,7 @@ const Person =
changeValue(id, 'phone', inputPhone)
}

const setGender = (inputGender : string) => {
const setGender = (inputGender : GenderType) => {
changeValue(id, 'gender', inputGender)
}

Expand Down
5 changes: 4 additions & 1 deletion src/components/NewResv/Form/PersonInfo/PersonInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,14 @@ const PersonInfo = (props : {persons : PersonData[], setPersons : Function}) =>
case 'phone':
updatePerson.phone = value;
break;
case 'gender':
updatePerson.gender = value;
break;
case 'remark':
updatePerson.remark = value;
break;
default:
break;
return;
}
persons[id-1] = updatePerson;
setPersons([...persons]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const Gender = (props : {value:GenderType, setGender:Function}) => {
<Select
onChange={changeGender}
label={t("gender")}
defaultValue={value}
defaultValue={'other'}
>
<MenuItem value='male'> {t('male')} </MenuItem>
<MenuItem value='female'> {t('female')} </MenuItem>
Expand Down

0 comments on commit 51ce802

Please sign in to comment.