Skip to content

Commit

Permalink
feat(ui): Delete "More filters" button, see #13
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Oct 20, 2023
1 parent 8c5e0dd commit f281096
Showing 1 changed file with 22 additions and 36 deletions.
58 changes: 22 additions & 36 deletions client/src/pages/home/filters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export default function Filters({ sendQuery }) {
dataIdentifiers: identifiers,
datasources: sources.map((source) => source.key),
endYear: '2021',
moreOptions: false,
startYear: '2021',
});
} else {
Expand All @@ -39,7 +38,6 @@ export default function Filters({ sendQuery }) {
dataIdentifiers: searchParams.getAll('dataIdentifiers'),
datasources: searchParams.getAll('datasources'),
endYear: searchParams.get('endYear'),
moreOptions: searchParams.get('moreOptions')?.toString() === 'true',
startYear: searchParams.get('startYear'),
});
}
Expand Down Expand Up @@ -118,41 +116,29 @@ export default function Filters({ sendQuery }) {
</Col>
</Row>
</Col>
{
currentSearchParams.moreOptions && (
<Col n="3">
{
currentSearchParams.datasources.includes('bso') && (
<>
BSO Identifiers:
<CheckboxGroup isInline>
{
identifiers.map((identifier) => (
<Checkbox
checked={currentSearchParams.dataIdentifiers.includes(identifier)}
key={identifier}
label={identifier}
onChange={() => onIdentifiersChange(identifier)}
size="sm"
/>
))
}
</CheckboxGroup>
</>
)
}
</Col>
)
}
<Col n="3">
{
currentSearchParams.datasources.includes('bso') && (
<>
BSO Identifiers:
<CheckboxGroup isInline>
{
identifiers.map((identifier) => (
<Checkbox
checked={currentSearchParams.dataIdentifiers.includes(identifier)}
key={identifier}
label={identifier}
onChange={() => onIdentifiersChange(identifier)}
size="sm"
/>
))
}
</CheckboxGroup>
</>
)
}
</Col>
<Col className="text-right">
<Button
onClick={() => setSearchParams({ ...currentSearchParams, moreOptions: !currentSearchParams.moreOptions })}
secondary
size="sm"
icon="ri-filter-line"
>
{currentSearchParams.moreOptions ? 'Less filters' : 'More filters'}
</Button>
<Button
icon="ri-search-line"
onClick={checkAndSendQuery}
Expand Down

0 comments on commit f281096

Please sign in to comment.