-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ClearFiltersButton improvements (#36)
* ClearFiltersButton horizontally sticky * wip: horizontal scroll detected; width set correctly before scroll * wip: width is set correctly during expansion (issue when scrolling past) * wip: working properly for scrolling (issue: resize/other changes) * App test setup * simplify solution (removed manual calculations) * Revert "App test setup" This reverts commit b551716. * Cleanup Co-authored-by: Michael Förg <[email protected]>
- Loading branch information
Showing
3 changed files
with
33 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import { defaultClasses } from '../theme/defaultTheme/defaultClasses'; | ||
import { useTableContext, useTheme } from '..'; | ||
|
||
export default function ClearFiltersButton<T>() { | ||
const Button = useTheme((t) => t.components.Button); | ||
const textClearFilters = useTheme((t) => t.text.clearFilters); | ||
const table = useTableContext<T>(); | ||
|
||
return ( | ||
<div css={defaultClasses.clearFiltersButton}> | ||
<Button | ||
variant="text" | ||
onClick={() => { | ||
table.update((state) => { | ||
state.activeColumns.forEach((column) => { | ||
state.filterValues.delete(column.id); | ||
}); | ||
}); | ||
}} | ||
> | ||
{textClearFilters} | ||
</Button> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters