import { modelSearchAtom } from "@/_helpers/JotaiWrapper"; import { MagnifyingGlassIcon } from "@heroicons/react/24/outline"; import { useSetAtom } from "jotai"; import { useState } from "react"; export enum SearchType { Model = "model", } type Props = { type?: SearchType; placeholder?: string; }; const SearchBar: React.FC = ({ type, placeholder }) => { const [searchValue, setSearchValue] = useState(""); const setModelSearch = useSetAtom(modelSearchAtom); let placeholderText = placeholder ? placeholder : "Search (⌘K)"; const handleKeyDown = (event: React.KeyboardEvent) => { if (event.key === "Enter") { if (type === SearchType.Model) { setModelSearch(searchValue); } } }; const handleChange = (event: React.ChangeEvent) => { setSearchValue(event.target.value); }; return (
); }; export default SearchBar;