"use client" import { usePathname, useRouter, useSearchParams } from "next/navigation" import React, { FormEvent, useState } from "react" import { Select, SelectContent, SelectTrigger, SelectItem, SelectValue } from "./ui/select" import { SitesCombobox } from "./SitesCombobox" import { FILTER_TIMES } from "@/utils" type Props = { value: string placeholder?: string className?: string filters?: { sites: { value: string; label: string }[] } } const SimplifiedSearchBar = ({ value: initialValue, placeholder, filters, className }: Props) => { const searchParams = useSearchParams() const pathname = usePathname() const router = useRouter() const [value, setValue] = useState(initialValue) const handleSearch = (event: FormEvent) => { event.preventDefault() const newSearchParams = new URLSearchParams(searchParams ?? undefined) if (value) { newSearchParams.set("q", value) } else { newSearchParams.delete("q") } router.push(`${pathname}?${newSearchParams}`) } return (
results:
setValue(e.target.value)} size={value.length} />
{/* Dropdown component should be here */} {/* Dropdown component should be here */}
) } export default SimplifiedSearchBar