import LocationD from "../../icons/LocationD";
import { Button } from "@mui/material";
import ModalSearchCity from "@/app/component/modalSearchCity";
import { useState } from "react";

function FilterLocate({ filter, sendReq, setFilter, setDataInURL }) {
  const [open, setOpen] = useState(false);

  return (
    <ModalSearchCity
      open={open}
      filter={filter}
      sendReq={sendReq}
      setOpen={setOpen}
      setFilter={setFilter}
      setDataInURL={setDataInURL}
    >
      <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">
          {" "}
          {filter?.state?.name || "استان"}
          {" / "}
          {filter?.city?.name || "شهر"}
        </h1>
      </Button>
    </ModalSearchCity>
  );
}

export default FilterLocate;
