handle like comments data, req for update comments and add loading for like comment && search specialty with searchbar in doctors page && set category and specialty data
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
import { Autocomplete, TextField } from "@mui/material";
|
||||
|
||||
function AutoComplete({
|
||||
data,
|
||||
noneBg,
|
||||
clearText,
|
||||
inputValue,
|
||||
placeholder,
|
||||
handleSearch,
|
||||
setInputValue,
|
||||
setSelectedOption,
|
||||
}) {
|
||||
const clearIndicatorProps = clearText
|
||||
? {
|
||||
clearIndicator: {
|
||||
onClick: () => {
|
||||
clearText();
|
||||
},
|
||||
},
|
||||
}
|
||||
: {};
|
||||
console.log(inputValue);
|
||||
|
||||
return (
|
||||
<Autocomplete
|
||||
freeSolo
|
||||
options={data}
|
||||
getOptionLabel={(option) => option.name}
|
||||
disableClearable
|
||||
inputValue={inputValue || ""}
|
||||
className="!w-full"
|
||||
onInputChange={(_, newInputValue) => {
|
||||
setInputValue && setInputValue(newInputValue);
|
||||
handleSearch(newInputValue);
|
||||
}}
|
||||
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: noneBg ? "" : "#ffffff !important",
|
||||
},
|
||||
}}
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
{...params}
|
||||
variant="standard"
|
||||
placeholder={placeholder}
|
||||
dir="rtl"
|
||||
InputProps={{
|
||||
...params.InputProps,
|
||||
disableUnderline: true,
|
||||
style: { height: "100%" },
|
||||
}}
|
||||
sx={{
|
||||
background: "transparent !important",
|
||||
"& .MuiInputBase-input": {
|
||||
background: "#FAFAFA",
|
||||
color: "#6C757D",
|
||||
padding: "0 16px",
|
||||
fontSize: "14px",
|
||||
fontFamily: "inherit",
|
||||
},
|
||||
}}
|
||||
className="!shadow-none !w-full !px-5 !h-full !text-[14px] md:!text-[16px] !min-w-[50%] !rounded-0 !font-normal"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default AutoComplete;
|
||||
Reference in New Issue
Block a user