import "./ModalSearch.style.scss"; import InputText from "../../Auth/InputText"; import classnames from "classnames"; import { modalSearchLogic } from "./ModalSearch.logic"; const ModalSearch = (props) => { let { titleHeader, placeholderSearch, listDataOptions, handleCloseModal, handleSelectOption, } = props; let { listDataOptionsSide, valueSearch, setValueSearch, handleResetValueSearch, changeValueSearch, } = modalSearchLogic(props); // Render Auth Icon Search const renderAuthIcon = (type) => { return (
handleSearchMockTest()} > Icon Input
); }; // Render Option const renderOptionSearch = (option, index) => { return (
handleSelectOption(option)} > {option?.title}
); }; return (
{titleHeader ?? ""}
Icon Close
renderAuthIcon("search")} errorAbsolute={false} onFocus={() => setValueSearch(valueSearch?.trim())} onKeyDown={(e) => { if(e.key === "Enter") { e.preventDefault(); if(!!listDataOptionsSide?.length) { handleSelectOption(listDataOptionsSide[0]) } } }} >
{listDataOptionsSide && listDataOptionsSide?.length > 0 ? ( listDataOptionsSide?.map((option, index) => renderOptionSearch(option, index) ) ) : (
Không có kết quả tìm kiếm phù hợp.
)}
); }; export default ModalSearch;