From 08b92f8bea4c3f8733d4f06873a004ab1a680c90 Mon Sep 17 00:00:00 2001 From: zojgame Date: Mon, 8 Apr 2024 16:04:09 +0500 Subject: [PATCH] mark --- src/components/Mark.tsx | 46 ++++++++------------------ src/components/Marks.tsx | 52 ++++++++++++++++++++--------- src/pages/InfrastructurePage.tsx | 57 +++++++++++++++++++++++--------- 3 files changed, 92 insertions(+), 63 deletions(-) diff --git a/src/components/Mark.tsx b/src/components/Mark.tsx index ac8164b..2e1c62d 100644 --- a/src/components/Mark.tsx +++ b/src/components/Mark.tsx @@ -1,29 +1,30 @@ -import { useLayoutEffect, useState } from "react"; +// import { useLayoutEffect, useState } from "react"; -function Mark() { - const [screenWidth, setScreenWidth] = useState(0); - useLayoutEffect(() => { - const width = window.innerWidth; - setScreenWidth(width); - }, []); +interface MarkProps { + x: number; + y: number; +} + +function Mark({ x, y }: MarkProps) { return ( - + {/* */} - - - - - - ); } diff --git a/src/components/Marks.tsx b/src/components/Marks.tsx index 5457f4c..0915175 100644 --- a/src/components/Marks.tsx +++ b/src/components/Marks.tsx @@ -1,21 +1,41 @@ const Marks = () => { return ( - - - - - - - - - - - +
+ + + + + + + + + + + +
); }; diff --git a/src/pages/InfrastructurePage.tsx b/src/pages/InfrastructurePage.tsx index 7a3f136..b96fe0c 100644 --- a/src/pages/InfrastructurePage.tsx +++ b/src/pages/InfrastructurePage.tsx @@ -1,25 +1,39 @@ -import { useState } from "react"; +import { useEffect, useState } from "react"; +import ImageMarker from "react-image-marker"; import Button from "../components/Button"; import ArrowLeftIcon from "../components/icons/ArrowLeftIcon"; import CrossIcon from "../icons/CrossIcon"; import InfrastructureFilters from "../components/InfrastructurePage/InfrastructureFilters"; -import ImageMarker from "react-image-marker"; import Mark from "../components/Mark"; +import DistanceCircle from "../components/DistanceCircle"; const markers = [ { - top: 10, //10% of the image relative size from top - left: 50, //50% of the image relative size from left + top: 40, + left: 40, }, ]; function InfrastructurePage() { const [selectedRange, setSelectedRange] = useState(800); + const [width, setWidth] = useState(); + const [top, setTop] = useState(); + + function handleResize() { + setWidth(window.innerWidth); + setTop(window.innerWidth / 2 - window.innerHeight / 2); + } + + useEffect(() => { + handleResize(); + window.addEventListener("resize", handleResize); + return () => window.removeEventListener("resize", handleResize); + }, []); return (
{/*
*/} - {/* */} + {/* */} {/* */} {/*
*/}
@@ -34,16 +48,29 @@ function InfrastructurePage() {
- {/* */} - +
+ {/* */} + +
+ +
+
+ +
+
{/*