Skip to content

Commit

Permalink
Merge pull request #444 from beda-software/autohide-clear-filters-button
Browse files Browse the repository at this point in the history
Auto hide clear filters button in SearchBar when only one filter defined
  • Loading branch information
alexlipovka authored Feb 3, 2025
2 parents f2e156f + b32d5d3 commit bee7f64
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/SearchBar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Trans } from '@lingui/macro';
import { Button } from 'antd';
import { useMemo } from 'react';

import { SearchBarColumn } from './SearchBarColumn';
import { SearchBarMobile } from './SearchBarMobile';
import { S } from './styles';
import { SearchBarData } from './types';
import { SearchBarMobile } from './SearchBarMobile';
import { isSearchBarFilter } from './utils';
import { useMemo } from 'react';

interface SearchBarProps extends SearchBarData {
showInDrawerOnMobile?: boolean;
Expand All @@ -32,9 +32,11 @@ export function SearchBar(props: SearchBarProps) {
))}
</S.LeftColumn>

<Button onClick={onResetFilters}>
<Trans>Clear filters</Trans>
</Button>
{searchBarFilterValues.length > 1 ? (
<Button onClick={onResetFilters}>
<Trans>Clear filters</Trans>
</Button>
) : null}
</S.SearchBar>
<S.MobileFilters $showInDrawerOnMobile={showInDrawerOnMobile}>
<SearchBarMobile {...props} />
Expand Down

0 comments on commit bee7f64

Please sign in to comment.