"use client" import { usePathname, useRouter, useSearchParams } from "next/navigation" import { ChevronDownIcon } from "@heroicons/react/24/outline" import React, { FormEvent, useState } from "react" type Props = { value: string placeholder?: string className?: string } const SimplifiedSearchBar = ({ value: initialValue, placeholder, 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) 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 */}
All Sites
{/* Dropdown component should be here */}
All Times
) } export default SimplifiedSearchBar