diff --git a/app/src/frontend/building/building-view.tsx b/app/src/frontend/building/building-view.tsx index 0b7a97a2..d322d984 100644 --- a/app/src/frontend/building/building-view.tsx +++ b/app/src/frontend/building/building-view.tsx @@ -14,18 +14,28 @@ import StreetscapeContainer from './data-containers/streetscape'; import CommunityContainer from './data-containers/community'; import PlanningContainer from './data-containers/planning'; import LikeContainer from './data-containers/like'; +import { Building } from '../models/building'; + + +interface BuildingViewProps { + cat: string; + mode: 'view' | 'edit' | 'multi-edit'; + building: Building; + building_like: boolean; + user: any; + selectBuilding: (building: Building) => void +} /** * Top-level container for building view/edit form * * @param props */ -const BuildingView = (props) => { +const BuildingView: React.FunctionComponent = (props) => { switch (props.cat) { case 'location': return { case 'use': return { case 'type': return { case 'age': return { case 'size': return { case 'construction': return { case 'team': return { case 'sustainability': return { case 'streetscape': return { case 'community': return { case 'planning': return { case 'like': return = (props) => ( +const ContainerHeader: React.FunctionComponent = (props) => (
diff --git a/app/src/frontend/building/data-components/checkbox-data-entry.tsx b/app/src/frontend/building/data-components/checkbox-data-entry.tsx index bb7ea2f1..82bca162 100644 --- a/app/src/frontend/building/data-components/checkbox-data-entry.tsx +++ b/app/src/frontend/building/data-components/checkbox-data-entry.tsx @@ -2,8 +2,14 @@ import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; import { DataTitleCopyable } from './data-title'; +import { BaseDataEntryProps } from './data-entry'; -const DataEntry: React.FunctionComponent = (props) => { // TODO: remove any +interface CheckboxDataEntryProps extends BaseDataEntryProps { + value: boolean; +} + + +const CheckboxDataEntry: React.FunctionComponent = (props) => { return ( = (props) => { // TODO: remove any name={props.slug} checked={!!props.value} disabled={props.mode === 'view' || props.disabled} - onChange={props.onChange} + onChange={e => props.onChange(props.slug, e.target.checked)} />