Spaces:
Build error
Build error
File size: 1,070 Bytes
caae15f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
// SearchSection.tsx
"use client";
import { SearchResult } from "@/app/components/ui/search/search-types";
import { useState, ChangeEvent, FormEvent } from "react";
import useSearch from "@/app/components/ui/search/useSearch";
import SearchResults from "@/app/components/ui/search/search-results";
import SearchInput from "@/app/components/ui/search/search-input";
const SearchSection: React.FC = () => {
const [query, setQuery] = useState("");
const { searchResults, isLoading, handleSearch } = useSearch();
const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {
setQuery(e.target.value);
};
const handleSearchSubmit = (e: FormEvent) => {
e.preventDefault();
handleSearch(query);
};
return (
<div className="space-y-4 max-w-5xl w-full">
<SearchInput
query={query}
isLoading={isLoading}
onInputChange={handleInputChange}
onSearchSubmit={handleSearchSubmit}
/>
<SearchResults results={searchResults} isLoading={isLoading} />
</div>
);
};
export default SearchSection;
|