diff --git a/components/clinics/head/SearchBar.js b/components/clinics/head/SearchBar.js index 2b6bd3c..8ae2b4c 100644 --- a/components/clinics/head/SearchBar.js +++ b/components/clinics/head/SearchBar.js @@ -37,22 +37,6 @@ function SearchBar({ placeholder="جستجوی تخصص" handleSearch={handleSearch} /> - {/* handleSearch(e.target.value)} - InputProps={{ - disableUnderline: true, - }} - sx={{ - background: "transparent !important", - "& .MuiInputBase-input": { color: "#7E7E7E" }, - "& .MuiInput-root": { borderBottom: "none" }, - "& .MuiInputBase-root": { height: "100%" }, - }} - placeholder="جستجوی تخصص" - dir="rtl" - className={`!shadow-none !w-full !min-w-3 !px-5 !h-full bg-[#FAFAFA] !text-[14px] md:!text-[16px] lg:!min-w-[50%] !rounded-0 !font-normal !text-[#6C757D]`} - /> */} - + -
+
setData({ data, search: e })} diff --git a/components/searchHead/smSearch/AutoCompleteSearch.js b/components/searchHead/smSearch/AutoCompleteSearch.js index 1b1c511..f575894 100644 --- a/components/searchHead/smSearch/AutoCompleteSearch.js +++ b/components/searchHead/smSearch/AutoCompleteSearch.js @@ -2,12 +2,25 @@ import { Autocomplete, TextField } from "@mui/material"; function AutoCompleteSearch({ data, + noneBg, + clearText, inputValue, placeholder, handleSearch, setInputValue, setSelectedOption, }) { + // ایجاد props شرطی برای clearIndicator + const clearIndicatorProps = clearText + ? { + clearIndicator: { + onClick: () => { + clearText(); + }, + }, + } + : {}; + return ( option.name} inputValue={inputValue} className="!w-full" - onInputChange={(event, newInputValue) => { + onInputChange={(_, newInputValue) => { setInputValue && setInputValue(newInputValue); handleSearch(newInputValue); }} - onChange={(event, newValue) => { + onChange={(_, newValue) => { setSelectedOption && setSelectedOption(newValue); handleSearch(newValue ? newValue.name : ""); }} + componentsProps={clearIndicatorProps} renderOption={(props, option) => (
  • - {" "} {option.name}
  • )} sx={{ "& .MuiAutocomplete-input": { - background: "#ffffff !important", + background: noneBg ? "" : "#ffffff !important", }, }} renderInput={(params) => (