Skip to content

Commit

Permalink
Add clear filters action
Browse files Browse the repository at this point in the history
  • Loading branch information
apata committed Nov 20, 2024
1 parent 0ce4a9f commit bacbfe4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions assets/js/dashboard/nav-menu/filters-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from '../components/dropdown'
import { FilterPillsList, PILL_X_GAP } from './filter-pills-list'
import { useQueryContext } from '../query-context'
import { AppNavigationLink } from '../navigation/use-app-navigate'

const LEFT_ACTIONS_GAP_PX = 16
const SEE_MORE_GAP_PX = 16
Expand Down Expand Up @@ -210,6 +211,7 @@ export const FiltersBar = () => {
start: visibility.visibleCount
}}
/>
<ClearAction />
</DropdownMenuWrapper>
) : null}
</ToggleDropdownButton>
Expand All @@ -218,3 +220,18 @@ export const FiltersBar = () => {
</div>
)
}


const ClearAction = () => (
<AppNavigationLink
title="Clear all filters"
className="flex mt-2 px-3 py-2 text-sm text-gray-500 hover:text-indigo-700 dark:hover:text-indigo-500"
search={(search) => ({
...search,
filters: null,
labels: null
})}
>
Clear all filters
</AppNavigationLink>
)

0 comments on commit bacbfe4

Please sign in to comment.