Skip to content

Commit 9d22ce9

Browse files
committed
MP-229 7 MP-306 edu year picker
1 parent 5981ffb commit 9d22ce9

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

src/apps/profiles/src/member-profile/education-and-certifications/ModifyEducationModal/ModifyEducationModal.module.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,14 @@
8282
display: flex;
8383
justify-content: space-between;
8484
width: 100%;
85+
}
86+
87+
.eduModal {
88+
@include gtemd {
89+
overflow: visible !important;
90+
}
91+
}
92+
93+
.eduModalBody {
94+
overflow: visible !important;
8595
}

src/apps/profiles/src/member-profile/education-and-certifications/ModifyEducationModal/ModifyEducationModal.tsx

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { Dispatch, FC, MutableRefObject, SetStateAction, useRef, useState } from 'react'
2-
import { bind, trim } from 'lodash'
2+
import { bind, range, trim } from 'lodash'
33
import { toast } from 'react-toastify'
4+
import { getYear } from 'date-fns'
45
import classNames from 'classnames'
56

6-
import { BaseModal, Button, IconOutline, InputDatePicker, InputText } from '~/libs/ui'
7+
import { BaseModal, Button, IconOutline, InputSelect, InputText } from '~/libs/ui'
78
import {
89
createMemberTraitsAsync,
910
updateMemberTraitsAsync,
@@ -29,6 +30,13 @@ const methodsMap: { [key: string]: any } = {
2930
update: updateMemberTraitsAsync,
3031
}
3132

33+
const years: number[] = range(1979, getYear(new Date()) + 10)
34+
const yearOptions: any = years
35+
.map(v => ({
36+
label: `${v}`,
37+
value: `${v}`,
38+
}))
39+
3240
const ModifyEducationModal: FC<ModifyEducationModalProps> = (props: ModifyEducationModalProps) => {
3341
const [isSaving, setIsSaving]: [boolean, Dispatch<SetStateAction<boolean>>]
3442
= useState<boolean>(false)
@@ -92,7 +100,7 @@ const ModifyEducationModal: FC<ModifyEducationModalProps> = (props: ModifyEducat
92100

93101
switch (key) {
94102
case 'endDate':
95-
value = event as unknown as Date
103+
value = new Date(event.target.value)
96104
break
97105
default:
98106
value = event.target.value
@@ -188,6 +196,10 @@ const ModifyEducationModal: FC<ModifyEducationModalProps> = (props: ModifyEducat
188196

189197
return (
190198
<BaseModal
199+
bodyClassName={styles.eduModalBody}
200+
classNames={{
201+
modal: styles.eduModal,
202+
}}
191203
onClose={props.onClose}
192204
open
193205
size='lg'
@@ -270,7 +282,17 @@ const ModifyEducationModal: FC<ModifyEducationModalProps> = (props: ModifyEducat
270282
onChange={bind(handleFormValueChange, this, 'major')}
271283
value={formValues.major as string}
272284
/>
273-
<InputDatePicker
285+
<InputSelect
286+
options={yearOptions}
287+
value={`${getYear(formValues.endDate as Date)}`}
288+
onChange={bind(handleFormValueChange, this, 'endDate')}
289+
dirty
290+
error={formErrors.endDate}
291+
name='endDate'
292+
label='End Year or Expected'
293+
placeholder='Select a year'
294+
/>
295+
{/* <InputDatePicker
274296
label='End date (or expected)'
275297
date={formValues.endDate as Date}
276298
onChange={bind(handleFormValueChange, this, 'endDate')}
@@ -280,7 +302,7 @@ const ModifyEducationModal: FC<ModifyEducationModalProps> = (props: ModifyEducat
280302
showMonthPicker={false}
281303
showYearPicker
282304
dateFormat='yyyy'
283-
/>
305+
/> */}
284306
</form>
285307
) : (
286308
<Button

0 commit comments

Comments
 (0)