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
This commit is contained in:
@@ -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 (
|
||||
<Autocomplete
|
||||
freeSolo
|
||||
@@ -15,23 +28,23 @@ function AutoCompleteSearch({
|
||||
getOptionLabel={(option) => 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) => (
|
||||
<li {...props} key={option.id}>
|
||||
{" "}
|
||||
{option.name}
|
||||
</li>
|
||||
)}
|
||||
sx={{
|
||||
"& .MuiAutocomplete-input": {
|
||||
background: "#ffffff !important",
|
||||
background: noneBg ? "" : "#ffffff !important",
|
||||
},
|
||||
}}
|
||||
renderInput={(params) => (
|
||||
|
||||
Reference in New Issue
Block a user