Skip to content

Commit

Permalink
Avoid duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
ssb-cgn committed Oct 6, 2023
1 parent ba51db4 commit 8ff7f58
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions src/main/resources/react4xp/_entries/KeyFigure.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,33 +46,25 @@ class KeyFigures extends React.Component {
if (this.props.showPreviewDraft) {
if (this.state.fetchUnPublished) {
return keyFigures.map((keyFigure, i) => {
if (this.props.draftExist && keyFigure.number) {
return (
<Col
key={`${keyFigure.number || keyFigure.title}${i}`}
className={`col-12${this.props.isInStatisticsPage ? ' p-0' : ''}`}
>
return (
<Col
key={`${keyFigure.number || keyFigure.title}${i}`}
className={`col-12${this.props.isInStatisticsPage ? ' p-0' : ''}`}
>
{this.props.draftExist && keyFigure.number ? (
<Alert variant='info' className='mb-4'>
Tallet i nøkkeltallet nedenfor er upublisert
</Alert>
</Col>
)
} else {
return (
<Col
key={`${keyFigure.number || keyFigure.title}${i}`}
className={`col-12${this.props.isInStatisticsPage ? ' p-0' : ''}`}
>
) : (
<Alert variant='warning' className='mb-4'>
Finnes ikke upubliserte tall for dette nøkkeltallet
</Alert>
</Col>
)
}
)}
</Col>
)
})
}
}
return
}

createRows() {
Expand Down

0 comments on commit 8ff7f58

Please sign in to comment.