import { useState } from "preact/hooks";
import { SearchBar } from "../components/SearchBar.tsx";


export default function MySearch({query}: {query?: string}) {
    const [searchValue, setSearchValue] = useState(query ?? "");
    
    return (
        <SearchBar value={searchValue} onChange={(v) => {setSearchValue(v)}} onSubmit={()=>{
            window.location.href = `/?q=${searchValue}`;
        }} />);
}