search_awesome/islands/MySearchBar.tsx
2022-12-01 19:40:03 +09:00

12 lines
412 B
TypeScript

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}`;
}} />);
}