import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; import Tooltip from '../../components/tooltip'; import DataTitle from './data-title'; const UPRNsDataEntry = (props) => { const uprns = props.value || []; const noParent = uprns.filter(uprn => uprn.parent_uprn == null); const withParent = uprns.filter(uprn => uprn.parent_uprn != null); return (
{ noParent.length?
    { noParent.map(uprn => (
  • {uprn.uprn}
  • )) }
: '\u00A0' } { withParent.length?
Children
    { withParent.map(uprn => (
  • {uprn.uprn} (child of {uprn.parent_uprn})
  • )) }
: null }
) } UPRNsDataEntry.propTypes = { title: PropTypes.string, tooltip: PropTypes.string, value: PropTypes.arrayOf(PropTypes.shape({ uprn: PropTypes.string.isRequired, parent_uprn: PropTypes.string })) } export default UPRNsDataEntry;