mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-11 01:53:58 +00:00
♻️ use the same clear filter text for clearing filters in the column filter buttons
This commit is contained in:
@@ -17,6 +17,7 @@ import { CheckIcon, ChevronDownIcon, Funnel } from "lucide-react";
|
|||||||
import { cn } from "@app/lib/cn";
|
import { cn } from "@app/lib/cn";
|
||||||
import { dataTableFilterPopoverContentClassName } from "@app/lib/dataTableFilterPopover";
|
import { dataTableFilterPopoverContentClassName } from "@app/lib/dataTableFilterPopover";
|
||||||
import { Badge } from "./ui/badge";
|
import { Badge } from "./ui/badge";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
interface FilterOption {
|
interface FilterOption {
|
||||||
value: string;
|
value: string;
|
||||||
@@ -27,7 +28,6 @@ interface ColumnFilterButtonProps {
|
|||||||
options: FilterOption[];
|
options: FilterOption[];
|
||||||
selectedValue?: string;
|
selectedValue?: string;
|
||||||
onValueChange: (value: string | undefined) => void;
|
onValueChange: (value: string | undefined) => void;
|
||||||
placeholder?: string;
|
|
||||||
searchPlaceholder?: string;
|
searchPlaceholder?: string;
|
||||||
emptyMessage?: string;
|
emptyMessage?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
@@ -38,7 +38,6 @@ export function ColumnFilterButton({
|
|||||||
options,
|
options,
|
||||||
selectedValue,
|
selectedValue,
|
||||||
onValueChange,
|
onValueChange,
|
||||||
placeholder,
|
|
||||||
searchPlaceholder = "Search...",
|
searchPlaceholder = "Search...",
|
||||||
emptyMessage = "No options found",
|
emptyMessage = "No options found",
|
||||||
className,
|
className,
|
||||||
@@ -50,6 +49,8 @@ export function ColumnFilterButton({
|
|||||||
(option) => option.value === selectedValue
|
(option) => option.value === selectedValue
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const t = useTranslations();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover open={open} onOpenChange={setOpen}>
|
<Popover open={open} onOpenChange={setOpen}>
|
||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
@@ -94,7 +95,7 @@ export function ColumnFilterButton({
|
|||||||
}}
|
}}
|
||||||
className="text-muted-foreground"
|
className="text-muted-foreground"
|
||||||
>
|
>
|
||||||
Clear filter
|
{t("accessFilterClear")}
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
)}
|
)}
|
||||||
{options.map((option) => (
|
{options.map((option) => (
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ export function ColumnMultiFilterButton({
|
|||||||
}}
|
}}
|
||||||
className="text-muted-foreground"
|
className="text-muted-foreground"
|
||||||
>
|
>
|
||||||
{t("accessUsersRoleFilterClear")}
|
{t("accessFilterClear")}
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
)}
|
)}
|
||||||
{options.map((option) => (
|
{options.map((option) => (
|
||||||
|
|||||||
Reference in New Issue
Block a user