Skip to content
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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

fredrikmonsen
Copy link
Collaborator

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).

Copy link

@EchoMi0 EchoMi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 noe pirk

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Camelcase takk

Comment on lines +43 to +127
<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>
</>
)}
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants