search_awesome/islands/MySearchBar.tsx

12 lines
412 B
TypeScript
Raw Permalink Normal View History

2022-12-01 19:40:03 +09:00
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}`;
}} />);
}