Skip to content

Commit

Permalink
fix: prop types
Browse files Browse the repository at this point in the history
  • Loading branch information
friedjoff committed Sep 15, 2020
1 parent 983a3f8 commit 53ed080
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/components/ForestTypeDescription/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function ForestTypeDescription({ data }) {
}

ForestTypeDescription.propTypes = {
data: PropTypes.arrayOf().isRequired,
data: PropTypes.shape().isRequired,
};

export default ForestTypeDescription;
5 changes: 4 additions & 1 deletion src/components/ForestTypeModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ function ForestTypeModal({ data, setIsForestTypeModalOpen }) {
}

ForestTypeModal.propTypes = {
data: PropTypes.arrayOf().isRequired,
data: PropTypes.shape({
code: PropTypes.string,
la: PropTypes.string,
}).isRequired,
setIsForestTypeModalOpen: PropTypes.func,
};

Expand Down
30 changes: 16 additions & 14 deletions src/components/LocationForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ function LocationForm() {
onChange={(e, { checked: carbonateFine }) =>
dispatch(setFormLocation({ carbonateFine }))
}
checked={formLocation.carbonateFine || ''}
checked={formLocation.carbonateFine || false}
/>
<Checkbox
label={t('forestType.carbonate.rock')}
onChange={(e, { checked: carbonateRock }) =>
dispatch(setFormLocation({ carbonateRock }))
}
checked={formLocation.carbonateRock || ''}
checked={formLocation.carbonateRock || false}
/>
</>
),
Expand All @@ -190,28 +190,28 @@ function LocationForm() {
onChange={(e, { checked: geomorphologyRockBand }) =>
dispatch(setFormLocation({ geomorphologyRockBand }))
}
checked={formLocation.geomorphologyRockBand || ''}
checked={formLocation.geomorphologyRockBand || false}
/>
<Checkbox
label={t('forestType.geomorphology.blockyRockyStrong')}
onChange={(e, { checked: geomorphologyBlockyRockyStrong }) =>
dispatch(setFormLocation({ geomorphologyBlockyRockyStrong }))
}
checked={formLocation.geomorphologyBlockyRockyStrong || ''}
checked={formLocation.geomorphologyBlockyRockyStrong || false}
/>
<Checkbox
label={t('forestType.geomorphology.blockyRockyLittle')}
onChange={(e, { checked: geomorphologyBlockyRockyLittle }) =>
dispatch(setFormLocation({ geomorphologyBlockyRockyLittle }))
}
checked={formLocation.geomorphologyBlockyRockyLittle || ''}
checked={formLocation.geomorphologyBlockyRockyLittle || false}
/>
<Checkbox
label={t('forestType.geomorphology.limestonePavement')}
onChange={(e, { checked: geomorphologyLimestonePavement }) =>
dispatch(setFormLocation({ geomorphologyLimestonePavement }))
}
checked={formLocation.geomorphologyLimestonePavement || ''}
checked={formLocation.geomorphologyLimestonePavement || false}
/>
<Checkbox
label={t('forestType.geomorphology.rocksModeratelyMoved')}
Expand All @@ -220,21 +220,23 @@ function LocationForm() {
setFormLocation({ geomorphologyRocksModeratelyMoved }),
)
}
checked={formLocation.geomorphologyRocksModeratelyMoved || ''}
checked={
formLocation.geomorphologyRocksModeratelyMoved || false
}
/>
<Checkbox
label={t('forestType.geomorphology.rocksStronglyMoved')}
onChange={(e, { checked: geomorphologyRocksStronglyMoved }) =>
dispatch(setFormLocation({ geomorphologyRocksStronglyMoved }))
}
checked={formLocation.geomorphologyRocksStronglyMoved || ''}
checked={formLocation.geomorphologyRocksStronglyMoved || false}
/>
<Checkbox
label={t('forestType.geomorphology.rocksStabilised')}
onChange={(e, { checked: geomorphologyRocksStabilised }) =>
dispatch(setFormLocation({ geomorphologyRocksStabilised }))
}
checked={formLocation.geomorphologyRocksStabilised || ''}
checked={formLocation.geomorphologyRocksStabilised || false}
/>
</Segment>
<Segment>
Expand All @@ -244,35 +246,35 @@ function LocationForm() {
onChange={(e, { checked: reliefTypeCentralSlope }) =>
dispatch(setFormLocation({ reliefTypeCentralSlope }))
}
checked={formLocation.reliefTypeCentralSlope || ''}
checked={formLocation.reliefTypeCentralSlope || false}
/>
<Checkbox
label={t('forestType.reliefType.hollow')}
onChange={(e, { checked: reliefTypeHollow }) =>
dispatch(setFormLocation({ reliefTypeHollow }))
}
checked={formLocation.reliefTypeHollow || ''}
checked={formLocation.reliefTypeHollow || false}
/>
<Checkbox
label={t('forestType.reliefType.dome')}
onChange={(e, { checked: reliefTypeDome }) =>
dispatch(setFormLocation({ reliefTypeDome }))
}
checked={formLocation.reliefTypeDome || ''}
checked={formLocation.reliefTypeDome || false}
/>
<Checkbox
label={t('forestType.reliefType.plateau')}
onChange={(e, { checked: reliefTypePlateau }) =>
dispatch(setFormLocation({ reliefTypePlateau }))
}
checked={formLocation.reliefTypePlateau || ''}
checked={formLocation.reliefTypePlateau || false}
/>
<Checkbox
label={t('forestType.reliefType.steep')}
onChange={(e, { checked: reliefTypeSteep }) =>
dispatch(setFormLocation({ reliefTypeSteep }))
}
checked={formLocation.reliefTypeSteep || ''}
checked={formLocation.reliefTypeSteep || false}
/>
</Segment>
</>
Expand Down
5 changes: 3 additions & 2 deletions src/components/LocationResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function LocationResult() {
<Dropdown.Menu>
{otherForestTypeGroups
.map((group) => (
<>
<React.Fragment key={group}>
<Dropdown.Header content={t(`forestType.group.${group}`)} />
{forestTypes[group].map((key) => {
const ftInfo = info('forestType', key);
Expand All @@ -80,14 +80,15 @@ function LocationResult() {
{key} - {ftInfo[i18n.language]}
</>
}
key={key}
value={key}
onClick={(e, { value: forestType }) =>
selectForestType(forestType)
}
/>
);
})}
</>
</React.Fragment>
))
.reduce((ttft, ft) => ttft.concat(ft), [])}
</Dropdown.Menu>
Expand Down

0 comments on commit 53ed080

Please sign in to comment.