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