ente_nazionale_frontend/components/associations/association-search.tsx
2026-08-17 11:34:06 +03:00

37 lines
938 B
TypeScript

"use client";
import { Search, X } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
export function AssociationSearch({
value,
onChange,
}: {
value: string;
onChange: (value: string) => void;
}) {
return (
<div className="relative max-w-md">
<Search className="pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" />
<Input
value={value}
onChange={(e) => onChange(e.target.value)}
placeholder="Cerca per nome, indirizzo, P.IVA o RUNTS..."
className="pl-9 pr-9"
/>
{value && (
<Button
type="button"
variant="ghost"
size="icon-sm"
className="absolute right-1 top-1/2 -translate-y-1/2"
onClick={() => onChange("")}
>
<X className="size-4" />
</Button>
)}
</div>
);
}