Skip to content

Commit

Permalink
PR feedback: simplify div logic
Browse files Browse the repository at this point in the history
  • Loading branch information
raejohanek committed Nov 13, 2024
1 parent 559a198 commit fc9188c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/data_search/DatasetSearchFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export const DatasetSearchFooter = (props: DatasetSearchFooterProps) => {
const selectedStudies = _.uniq(
_.filter(datasets, dataset => selectedDatasets.includes(dataset.datasetId))
.map(dataset => dataset.study.studyId));
const datasetText = selectedDatasets.length > 1 ? 'datasets' : 'dataset';
const studyText = selectedStudies.length > 1 ? 'studies' : 'study';

return <div style={{
position: 'fixed',
bottom: 0,
Expand All @@ -25,9 +28,7 @@ export const DatasetSearchFooter = (props: DatasetSearchFooterProps) => {
border: '1px solid #DEDEDE',
alignItems: 'center'
}}>
{selectedDatasets.length > 1 && selectedStudies.length > 1 && (<div style={{paddingRight: 15}}> {selectedDatasets.length} Datasets selected from {selectedStudies.length} Studies </div>)}
{selectedDatasets.length > 1 && selectedStudies.length === 1 && (<div style={{paddingRight: 15}}> {selectedDatasets.length} Datasets selected from 1 Study </div>)}
{selectedDatasets.length === 1 && (<div style={{paddingRight: 15}}> 1 Dataset selected from 1 Study </div>)}
<div style={{paddingRight: 15}}>{selectedDatasets.length} {datasetText} selected from {selectedStudies.length} {studyText}</div>
<Button
variant='contained'
onClick={onClick}
Expand Down

0 comments on commit fc9188c

Please sign in to comment.