Files
nobat724_front/components/doctors/index.js
T

66 lines
2.0 KiB
JavaScript

"use client";
import { useEffect, useState } from "react";
import SearchBar from "./search";
import SortList from "./sortlist";
import { Button } from "@mui/material";
import ListDoctors from "./listDoctors";
import LocationD from "../icons/LocationD";
import ModalSearchCity from "@/app/component/modalSearchCity";
function DoctorsPage({ params, matchedCity, matchedState }) {
const [loading, setLoading] = useState(true);
const [open, setOpen] = useState(false);
const [selected, setSelected] = useState({
province: matchedState?.name || params?.province,
city: matchedCity?.name || params?.city,
});
const [data, setData] = useState({
category: "",
expertise: "",
turn: true,
gender: "خانم",
degree: "فوق تخصص",
});
useEffect(() => {
setTimeout(() => {
setLoading(false);
}, 2000);
}, []);
return (
<div className="pt-[95px] sm:pt-[120px] padding-responsive">
<div className="flex justify-center gap-[16px] sm:gap-[19px] md:gap-[22px] lg:gap-[24px] flex-col items-center mt-0 md:mt-[40px] lg:mt-[90px]">
<ModalSearchCity
open={open}
setOpen={setOpen}
selected={selected}
setSelected={setSelected}
>
<Button
className="!flex !ml-auto !w-fit !px-3 !py-1 !items-center !justify-start !gap-2 !cursor-pointer"
onClick={() => setOpen(true)}
>
<LocationD />
<h1 className="text-[#525252] text-[16px] font-semibold">
{" "}
{selected.province || "استان"}
{" / "}
{selected.city || "شهر"}
</h1>
</Button>
</ModalSearchCity>
<div className="flex flex-col lg:flex-row items-start lg:items-center justify-center gap-[24px] lg:gap-[32px] w-full">
<SearchBar data={data} setData={setData} params={params} />
<SortList data={data} setData={setData} />
</div>
</div>
<ListDoctors loading={loading} />
</div>
);
}
export default DoctorsPage;