Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Viser dash om epost er null
Browse files Browse the repository at this point in the history
  • Loading branch information
sneha-d-desai committed Sep 10, 2021
1 parent 3e48a63 commit f5979fb
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
19 changes: 14 additions & 5 deletions src/components/paneler/innhold/personaliaV2/epost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,27 @@ import { isNullOrUndefined } from '../../../../utils';
import Informasjonsbolk from '../../../felles/informasjonsbolk';
import {PersonaliaEpost} from "../../../../rest/datatyper/personaliav2";
import {hentKilde} from "../../../../utils/konstanter";
import EMDASH from "../../../../utils/emdash";

function Epost(props: { epost: PersonaliaEpost }) {
if (isNullOrUndefined(props.epost)) {
return null;
}

const { epost, ...rest } = props;

if (isNullOrUndefined(props.epost.epostAdresse)) {
return (
<Informasjonsbolk header="Epost" {...rest}>
{EMDASH}
</Informasjonsbolk>
);
}

return (
<Informasjonsbolk header="Epost" {...rest} className="break-all">
<Normaltekst>{epost.epostAdresse}</Normaltekst>
<Undertekst color='#645f5a'>Registrert {epost.epostSistOppdatert && epost.epostSistOppdatert} <span>{`av ${hentKilde(epost.master)}`}</span> </Undertekst>
{epost.epostAdresse &&
<Undertekst color='#645f5a'>
<span>Registrert {epost.epostSistOppdatert && epost.epostSistOppdatert}{` av ${hentKilde(epost.master)}`}</span>
</Undertekst>
}
</Informasjonsbolk>
);
}
Expand Down
11 changes: 8 additions & 3 deletions src/components/paneler/innhold/personaliaV2/sivilstand.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ import { Normaltekst } from 'nav-frontend-typografi';
import { PersonaliaSivilstand } from '../../../../rest/datatyper/personalia';
import { formaterDato, isNullOrUndefined } from '../../../../utils';
import Informasjonsbolk from '../../../felles/informasjonsbolk';
import EMDASH from "../../../../utils/emdash";

function Sivilstand(props: { sivilstand: PersonaliaSivilstand }) {
const { sivilstand, ...rest } = props;

if (isNullOrUndefined(props.sivilstand)) {
return null;
return (
<Informasjonsbolk header="Sivilstand" {...rest}>
{EMDASH}
</Informasjonsbolk>
);
}

const { sivilstand, ...rest } = props;

return (
<Informasjonsbolk header="Sivilstand" {...rest}>
<Normaltekst>{sivilstand.sivilstand}</Normaltekst>
Expand Down
6 changes: 5 additions & 1 deletion src/components/paneler/innhold/personaliaV2/telefon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ function TelefonNrMedKilde(props: {telefon: PersonaliaTelefon}) {
return (
<div className="overinformasjon underinformasjon">
<Normaltekst>{telefonNr}</Normaltekst>
<Undertekst color='#645f5a'>Registrert {registrertDato && registrertDato} <span>{`av ${hentKilde(master)}`}</span> </Undertekst>
{telefonNr &&
<Undertekst color='#645f5a'>
<span>Registrert {registrertDato && registrertDato}{` av ${hentKilde(master)}`}</span>
</Undertekst>
}
</div>
);
}
Expand Down
3 changes: 1 addition & 2 deletions src/mock/api/veilarbperson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ const cvOgJobbprofil: ArenaPerson = {
{
tittel: 'blå',
arrangor: 'falk',
fraDato: '2018-10',
tidspunkt: '2018-10'
},
{
Expand Down Expand Up @@ -454,7 +453,7 @@ const personaliav2: PersonaliaV2Info = {
master: 'PDL'
}],
epost: {
epostAdresse:'tester.scrambling-script@fellesregistre.no',
epostAdresse:'tester.scrambling@registre.no',
epostSistOppdatert:'10.04.2010',
master:'KRR'
},
Expand Down

0 comments on commit f5979fb

Please sign in to comment.