refactor logic to use <form>

This commit is contained in:
Ed Chalstrey 2022-06-06 09:52:50 +01:00
parent 2b24d49333
commit e48414d647

View File

@ -18,8 +18,9 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
const building = props.building; const building = props.building;
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const currentBuildingConstructionYear = building.date_year || undefined; const currentBuildingConstructionYear = building.date_year || undefined;
if (props.building.is_extension == "The main building"){
return ( return (
<form>
{this.props.building.is_extension == "The main building" ? (
<Fragment> <Fragment>
<InfoBox msg="Can you help us capture information on who built the current building?"></InfoBox> <InfoBox msg="Can you help us capture information on who built the current building?"></InfoBox>
<SelectDataEntry <SelectDataEntry
@ -112,9 +113,7 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
mode={props.mode} mode={props.mode}
/> />
</Fragment> </Fragment>
); ) : (
};
return ( // This is what gets used when is_extension == "A major extension"
<Fragment> <Fragment>
<InfoBox msg="Can you help us capture information on who built the building extension?"></InfoBox> <InfoBox msg="Can you help us capture information on who built the building extension?"></InfoBox>
<SelectDataEntry <SelectDataEntry
@ -207,7 +206,9 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
mode={props.mode} mode={props.mode}
/> />
</Fragment> </Fragment>
); )}
</form>
);
}; };
const TeamContainer = withCopyEdit(TeamView); const TeamContainer = withCopyEdit(TeamView);