37 lines
938 B
TypeScript
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>
|
|
);
|
|
}
|