Skip to content

Commit f0ab080

Browse files
authored
Merge pull request #344 from softnetics/benz/feat/filter-classnames
feat: add classname props for filter
2 parents d14c288 + 028ec11 commit f0ab080

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

.changeset/lovely-owls-rest.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+
feat: add classname props for filter

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ export function getSelectedValues<T extends string>(options: FilterOption<T>[])
2727
export interface FilterProps<T extends FilterOptions = FilterOptions> {
2828
options: T
2929
onChange: (options: T) => void
30+
classNames?: {
31+
trigger?: string
32+
content?: string
33+
}
3034
}
3135

32-
export function Filter<T extends FilterOptions>({ options, onChange }: FilterProps<T>) {
36+
export function Filter<T extends FilterOptions>({ options, onChange, classNames }: FilterProps<T>) {
3337
const [openModal, setOpenModal] = React.useState(false)
3438
const [internalOptions, setInternalOptions] = React.useState<T>(options)
3539
const [selectedColumn, setSelectedColumn] = React.useState<string | null>(
@@ -82,14 +86,19 @@ export function Filter<T extends FilterOptions>({ options, onChange }: FilterPro
8286
return (
8387
<Popover open={openModal} onOpenChange={setOpenModal}>
8488
<PopoverTrigger asChild>
85-
<Button variant="outline" className="w-fit">
89+
<Button variant="outline" className={cn('w-fit', classNames?.trigger)}>
8690
<Typography className="text-icon-tertiary">Filter</Typography>
8791
<CountBadge count={totalSelected} />
8892
<SlidersHorizontalIcon className="text-icon-tertiary" />
8993
</Button>
9094
</PopoverTrigger>
9195
<PopoverContent asChild>
92-
<div className="w-fit py-6 bg-surface-primary border border-border-primary rounded-xl flex flex-col gap-4 min-w-[600px] h-[436px]">
96+
<div
97+
className={cn(
98+
'w-fit py-6 bg-surface-primary border border-border-primary rounded-xl flex flex-col gap-4 min-w-[600px] h-[436px]',
99+
classNames?.content
100+
)}
101+
>
93102
<Typography type="h4" weight="bold" className="px-6 text-lg w-full">
94103
Apply Filters
95104
</Typography>

0 commit comments

Comments
 (0)