-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow multiple phone and email records for contact information #63
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 noe pirk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Camelcase takk
<FieldArray | ||
name="phone" | ||
render={ () => ( | ||
<> | ||
<label className='group-subtitle-style mb-1 self-start'>Telefon</label> | ||
{values.contactInfo.map((contact, index) => ( | ||
contact.contact_type === 'phone' && ( | ||
<div key={index} className='flex flex-col'> | ||
|
||
<div> | ||
<div className='flex flex-row mb-3'> | ||
<Field | ||
type='text' | ||
id={`contactInfo[${index}].contact_value`} | ||
className='input-text-style' | ||
onChange={handleChange} | ||
onBlur={handleBlur} | ||
value={contact.contact_value ?? ''} | ||
/> | ||
<button | ||
type="button" | ||
className="row-action-button-style" | ||
onClick={() => handleRemove(values, index)} | ||
> | ||
<FaCircleMinus size={24} className='text-blue-500'/> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
))} | ||
<Button | ||
type="button" | ||
variant="light" | ||
color="primary" | ||
className='text-md' | ||
onClick={() => handleAdd(values, 'phone')} | ||
> | ||
+ Legg til telefon | ||
</Button> | ||
</> | ||
)} | ||
/> | ||
|
||
<label htmlFor='contact_phone' className='group-subtitle-style mb-1 self-start'> Telefon </label> | ||
<Field | ||
type='text' | ||
id='contact_phone' | ||
className='input-text-style' | ||
onChange={handleChange} | ||
onBlur={handleBlur} | ||
value={values.contact_phone ?? ''} | ||
<FieldArray | ||
name="email" | ||
render={ () => ( | ||
<> | ||
<label className='group-subtitle-style mb-1 self-start'>E-post</label> | ||
{values.contactInfo.map((contact, index) => ( | ||
contact.contact_type === 'email' && ( | ||
<div key={index} className='flex flex-col'> | ||
<div> | ||
<div className='flex flex-row mb-3'> | ||
<Field | ||
type='text' | ||
id={`contactInfo[${index}].contact_value`} | ||
className='input-text-style' | ||
onChange={handleChange} | ||
onBlur={handleBlur} | ||
value={contact.contact_value ?? ''} | ||
/> | ||
<button | ||
type="button" | ||
className="row-action-button-style" | ||
onClick={() => handleRemove(values, index)} | ||
> | ||
<FaCircleMinus size={24} className='text-blue-500'/> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
))} | ||
<Button | ||
type="button" | ||
variant="light" | ||
color="primary" | ||
className="text-md" | ||
onClick={() => handleAdd(values, 'email')} | ||
> | ||
+ Legg til e-post | ||
</Button> | ||
</> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vurder å lage komponent av disse, ganske like.
Fjernet ContactAndReleaseInfo.tsx da dette ble et rart abstraksjonslag hvor man stor sett bare sendte gjennom props og som gjorde den vanskelig å jobbe med.
Inneholder også patch oppdatering av next pga. sårbarheter pluss noe mindre refaktorering der deler av større komponenter ble delt inn i mindre komponenter (SuccessAlert og TitleNotFound).