majic / src /components /main /GraphSections.tsx
nolual's picture
Upload 55 files
0c20ea8
raw
history blame
1.56 kB
import React from "react";
import { Poi } from "../../redux/types/Poi";
import DemographicsSection from "../../sections/demographics";
import DescriptionSection from "../../sections/description";
import FootfallSection from "../../sections/footfall";
import ModeSection from "../../sections/mode";
import InformationSection from "../../sections/information";
import TraficSection from "../../sections/trafic";
type GraphSectionsProps = {
selectedPoi: Poi;
isDemographicsSection: boolean;
isFootfallSection: boolean;
isModeSection: boolean;
isInformationSection: boolean;
isTraficSection: boolean;
};
const GraphSections = ({
selectedPoi,
isDemographicsSection,
isFootfallSection,
isModeSection,
isInformationSection,
isTraficSection,
}: GraphSectionsProps) => {
const renderSection = (state: boolean, section: JSX.Element) => {
return state ? section : null;
};
return (
<>
<DescriptionSection selectedPoi={selectedPoi} />
{renderSection(
isDemographicsSection,
<DemographicsSection selectedPoi={selectedPoi} />
)}
{renderSection(
isFootfallSection,
<FootfallSection selectedPoi={selectedPoi} />
)}
{renderSection(isModeSection, <ModeSection selectedPoi={selectedPoi} />)}
{renderSection(
isInformationSection,
<InformationSection selectedPoi={selectedPoi} />
)}
{renderSection(
isTraficSection,
<TraficSection selectedPoi={selectedPoi} />
)}
</>
);
};
export default GraphSections;