import React, { Fragment } from 'react'; import { NavLink, Redirect } from 'react-router-dom'; import PropTypes from 'prop-types'; import Sidebar from './sidebar'; import { EditIcon } from './icons'; import CONFIG from './fields-config.json'; const Overview = (props) => { var dataLayer = 'age'; // always default if (props.match && props.match.params && props.match.params.cat) { dataLayer = props.match.params.cat; } if (props.mode === 'edit' && !props.user){ return } const title = (props.mode === 'view')? 'View maps' : 'Add or edit data'; const back = (props.mode === 'edit')? `/view/${dataLayer}.html` : undefined; return ( { CONFIG.map((dataGroup) => ( )) } ); } Overview.propTypes = { match: PropTypes.object, mode: PropTypes.string, user: PropTypes.object } const OverviewSection = (props) => { const match = props.dataLayer === props.slug; const inactive = props.inactive; return (
match} title={(inactive)? 'Coming soon… Click the ? for more info.' : (match)? '' : 'Show on map'}>

{props.title}

{ (match && props.intro)? (

{props.intro}

    { props.fields.map((field) => { return (
  • {field.title}
  • ) }) }
) : null }
) }; OverviewSection.propTypes = { title: PropTypes.string, slug: PropTypes.string, intro: PropTypes.string, help: PropTypes.string, dataLayer: PropTypes.string, mode: PropTypes.string, inactive: PropTypes.bool, fields: PropTypes.arrayOf(PropTypes.shape({ title: PropTypes.string, slug: PropTypes.string })) } export default Overview;