From a6386e693fa8dad0db6a8c73c1bd644892bd54a9 Mon Sep 17 00:00:00 2001 From: ehsan Date: Wed, 17 Sep 2025 20:08:42 +0330 Subject: [PATCH] change bg of auto-selector, remove value of search from url when click on x button on autoselector, remove to set data of search field in clinics page, fix remove data and update state filter after click on clearAll text in autoselector of doctors age --- components/clinics/head/SearchBar.js | 16 -------------- components/clinics/index.js | 8 +++---- components/doctors/head/index.js | 1 + components/doctors/search/SearchField.js | 20 ++++++++++++++++- components/doctors/search/SendReq.js | 22 +++++++------------ components/doctors/search/index.js | 7 +++++- components/home/search/Fields.js | 3 ++- .../searchHead/smSearch/AutoCompleteSearch.js | 21 ++++++++++++++---- 8 files changed, 57 insertions(+), 41 deletions(-) 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) => (