(null);
+
useEffect(() => setSelectedOption(defaultOption), [defaultOption]);
useEffect(() => onSelect(selectedOption), [selectedOption]);
+ function handleScroll() {
+ if (!dropDownRef.current) return;
+ dropDownRef.current.style.maxHeight = `calc(100vh - ${
+ dropDownRef.current?.getBoundingClientRect().y
+ }px - 0.278vw)`;
+ }
+
+ useEffect(() => {
+ handleScroll();
+ document.addEventListener("scroll", handleScroll);
+
+ return () => document.removeEventListener("scroll", handleScroll);
+ }, [isShow]);
+
return (
{label && (
@@ -58,12 +74,7 @@ function Select({
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.15 }}
- ref={(el) => {
- if (el)
- el.style.maxHeight = `calc(100vh - ${
- el?.getBoundingClientRect().y
- }px - 0.278vw)`;
- }}
+ ref={dropDownRef}
className="absolute 2xl:mt-[0.278vw] 2xl:pt-[0.278vw] mt-1 p-1 2xl:space-y-[0.139vw] space-y-0.5 shadow-[0px_2px_8px_rgba(0,0,0,0.15)] overflow-auto rounded-xl bg-white w-full z-10"
>
{options.map((option, index) => (
diff --git a/src/data/markers.ts b/src/data/markers.ts
index 39ae9f0..514daed 100644
--- a/src/data/markers.ts
+++ b/src/data/markers.ts
@@ -4,30 +4,27 @@ export const markers: IMarker[] = [
{
id: 1,
name: "downtown",
- x: "56.7%",
- y: "39.8%",
+ x: "54.2%",
+ y: "50.6%",
popupPosition: "left",
title: "Downtown",
- unitsCount: 100,
disabled: true,
},
{
id: 2,
name: "marasi-drive",
- x: "58.6%",
- y: "42%",
+ x: "55.6%",
+ y: "52.5%",
popupPosition: "right",
title: "Marasi Drive",
- unitsCount: 200,
},
{
id: 3,
name: "dubai-marina",
- x: "22.5%",
- y: "76%",
+ x: "35.35%",
+ y: "71.6%",
popupPosition: "right",
title: "Dubai Marina",
- unitsCount: 300,
disabled: true,
},
];
diff --git a/src/pages/ComplexPage.tsx b/src/pages/ComplexPage.tsx
index a563624..ba12c50 100644
--- a/src/pages/ComplexPage.tsx
+++ b/src/pages/ComplexPage.tsx
@@ -1,5 +1,6 @@
import SequenceSlider from "../components/SequenceSlider";
import { useParams } from "react-router";
+
export default function ComplexPage() {
const { complexName } = useParams();
diff --git a/src/types/IMarker.ts b/src/types/IMarker.ts
index 0a852b6..367d685 100644
--- a/src/types/IMarker.ts
+++ b/src/types/IMarker.ts
@@ -5,6 +5,5 @@ export default interface IMarker {
x: string;
y: string;
popupPosition: "left" | "right";
- unitsCount: number;
disabled?: boolean;
}