Skip to content

Commit e958a7b

Browse files
authored
Merge pull request #342 from softnetics/chayapon/feat/filter-components
Chayapon/feat/filter components
2 parents 2618fe3 + 8d55940 commit e958a7b

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

.changeset/lazy-coins-travel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@genseki/ui': patch
3+
---
4+
5+
fix: filter opions don't update when prop change

packages/ui/src/components/primitives/filter.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export function Filter<T extends FilterOptions>({ options, onChange }: FilterPro
3636
Object.keys(options)[0] ?? null
3737
)
3838

39+
React.useEffect(() => {
40+
setInternalOptions(options)
41+
}, [options])
42+
3943
function toggleItem(column: string, label: string) {
4044
setInternalOptions((prev) => {
4145
const prevOptions = prev[column]
@@ -79,9 +83,9 @@ export function Filter<T extends FilterOptions>({ options, onChange }: FilterPro
7983
<Popover open={openModal} onOpenChange={setOpenModal}>
8084
<PopoverTrigger asChild>
8185
<Button variant="outline" className="w-fit">
82-
<Typography>Filter</Typography>
86+
<Typography className="text-icon-tertiary">Filter</Typography>
8387
<CountBadge count={totalSelected} />
84-
<SlidersHorizontalIcon />
88+
<SlidersHorizontalIcon className="text-icon-tertiary" />
8589
</Button>
8690
</PopoverTrigger>
8791
<PopoverContent asChild>

0 commit comments

Comments
 (0)