change design dashboards all page and search clinics
This commit is contained in:
@@ -3,8 +3,15 @@ import SearchD from "@/components/icons/SearchD";
|
||||
import ModalSearchCity from "@/app/component/modalSearchCity";
|
||||
import { useState } from "react";
|
||||
import ButtonFilter from "@/app/component/modalSearchCity/ButtonFilter";
|
||||
import AutoCompleteSearch from "@/components/searchHead/smSearch/AutoCompleteSearch";
|
||||
|
||||
function SearchBar({ selected, setSelected, state, handleSearch }) {
|
||||
function SearchBar({
|
||||
selected,
|
||||
setSelected,
|
||||
specialties,
|
||||
state,
|
||||
handleSearch,
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
@@ -25,7 +32,12 @@ function SearchBar({ selected, setSelected, state, handleSearch }) {
|
||||
>
|
||||
<ButtonFilter setOpen={setOpen} selected={selected} />
|
||||
</ModalSearchCity>
|
||||
<TextField
|
||||
<AutoCompleteSearch
|
||||
data={specialties}
|
||||
placeholder="جستجوی تخصص"
|
||||
handleSearch={handleSearch}
|
||||
/>
|
||||
{/* <TextField
|
||||
variant="standard"
|
||||
onChange={(e) => handleSearch(e.target.value)}
|
||||
InputProps={{
|
||||
@@ -40,7 +52,7 @@ function SearchBar({ selected, setSelected, state, handleSearch }) {
|
||||
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]`}
|
||||
/>
|
||||
/> */}
|
||||
<Button
|
||||
onClick={handleSearch}
|
||||
className="
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
import { useState } from "react";
|
||||
|
||||
import List from "./list";
|
||||
import { searchOnList } from "@/helper";
|
||||
import SearchBar from "./head/SearchBar";
|
||||
import HeadPageList from "@/app/component/head";
|
||||
import { useRouter } from "next/navigation";
|
||||
import specialtiesData from "@/data/specialties.json";
|
||||
|
||||
function ClinicsPage({ clinics, matchedCity, matchedState }) {
|
||||
const router = useRouter();
|
||||
const [filteredClinics, setFilteredClinics] = useState(clinics);
|
||||
|
||||
const [selected, setSelected] = useState({
|
||||
@@ -16,9 +18,13 @@ function ClinicsPage({ clinics, matchedCity, matchedState }) {
|
||||
});
|
||||
|
||||
const handleSearch = (value) => {
|
||||
const searchOnName = searchOnList(clinics, value, "title");
|
||||
const searchOnLocation = searchOnList(searchOnName, selected.city, "city");
|
||||
setFilteredClinics(searchOnLocation);
|
||||
const current = new URLSearchParams(window.location.search);
|
||||
current.set("search", value);
|
||||
const queryString = current.toString();
|
||||
router.push(`/clinics?${queryString}`);
|
||||
// const searchOnName = searchOnList(clinics, value, "title");
|
||||
// const searchOnLocation = searchOnList(searchOnName, selected.city, "city");
|
||||
// setFilteredClinics(searchOnLocation);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -32,6 +38,7 @@ function ClinicsPage({ clinics, matchedCity, matchedState }) {
|
||||
setSelected={setSelected}
|
||||
state={matchedState?.name}
|
||||
handleSearch={handleSearch}
|
||||
specialties={specialtiesData}
|
||||
/>
|
||||
</HeadPageList>
|
||||
<List selected={selected} clinics={filteredClinics} />
|
||||
|
||||
Reference in New Issue
Block a user