From 152c46edf7448f96857662597fc2270f8e6f675f Mon Sep 17 00:00:00 2001 From: zojgame Date: Wed, 5 Jun 2024 12:01:10 +0500 Subject: [PATCH] mouse move apartment desc + hightlighting --- .../complexWingPage/FloorDescription.tsx | 2 +- .../FloorSidebar/ApartmentDescription.tsx | 33 +++++--- .../FloorSidebar/FloorSidebar.tsx | 52 ++++++++++-- .../FloorWestWingHighlighting.tsx | 82 ++++++------------- .../FloorSidebar/FloorWestWingLayout.tsx | 11 +-- .../complexWingPage/SkygardenDescription.tsx | 46 ++++++----- src/index.css | 4 + 7 files changed, 118 insertions(+), 112 deletions(-) diff --git a/src/components/complexWingPage/FloorDescription.tsx b/src/components/complexWingPage/FloorDescription.tsx index 0697285..ced1c96 100644 --- a/src/components/complexWingPage/FloorDescription.tsx +++ b/src/components/complexWingPage/FloorDescription.tsx @@ -80,7 +80,7 @@ const FloorDescription = ({ descriptionFloor }: FloorDescriptionProps) => { */}
{ +const ApartmentDescription = ({ isVisible }: ApartmentDescriptionProps) => { + useEffect(() => { + console.log("isVisible", isVisible); + }, [isVisible]); + return ( -
-

- 1 bedroom, 609 Sqft -

-

AED 1,668,888

+
+
+

+ 1 bedroom, 609 Sqft +

+

AED 1,668,888

+
+
); }; diff --git a/src/components/complexWingPage/FloorSidebar/FloorSidebar.tsx b/src/components/complexWingPage/FloorSidebar/FloorSidebar.tsx index ddc0d56..898f532 100644 --- a/src/components/complexWingPage/FloorSidebar/FloorSidebar.tsx +++ b/src/components/complexWingPage/FloorSidebar/FloorSidebar.tsx @@ -1,11 +1,38 @@ +import { useState, useEffect } from "react"; import { IDesctiptionFloor } from "../../../types/descriptionFloor"; +import ApartmentDescription from "./ApartmentDescription"; +import FloorWestWingHighlighting from "./FloorWestWingHighlighting"; import FloorWestWingLayout from "./FloorWestWingLayout"; interface IFloorSidebarProps { currentFloor: IDesctiptionFloor | null; onMouseEnter: () => void; } + const FloorSidebar = ({ currentFloor, onMouseEnter }: IFloorSidebarProps) => { + const [mousePos, setMousePos] = useState([0, 0]); + const [isDescVisible, setIsDescVisible] = useState(true); + + function handleMouseMove(e: MouseEvent) { + const top = window.innerWidth / 2 - window.innerHeight / 2; + // setMousePos([e.clientX, e.clientY - top]); + setMousePos([e.clientX - 752, e.clientY - Math.abs(top) + 5]); + } + + function handleOnMouseOut(): void { + setIsDescVisible(false); + } + function handleOnMouseOver(): void { + setIsDescVisible(true); + } + + useEffect(() => { + window.addEventListener("mousemove", handleMouseMove); + return () => { + window.removeEventListener("mousemove", handleMouseMove); + }; + }, []); + return (
{

2 Bedroom

- {/*
- {currentFloor?.wing === "West Wing" ? ( - - ) : ( - - )} -
*/}
- +
+ +
+ + + +
); diff --git a/src/components/complexWingPage/FloorSidebar/FloorWestWingHighlighting.tsx b/src/components/complexWingPage/FloorSidebar/FloorWestWingHighlighting.tsx index 2306cd4..7c94ff9 100644 --- a/src/components/complexWingPage/FloorSidebar/FloorWestWingHighlighting.tsx +++ b/src/components/complexWingPage/FloorSidebar/FloorWestWingHighlighting.tsx @@ -1,48 +1,14 @@ -import { useEffect, useState } from "react"; -import ApartmentDescription from "./ApartmentDescription"; -import { createPortal } from "react-dom"; -import { div } from "three/examples/jsm/nodes/Nodes.js"; - -const FloorWestWingHighlighting = () => { - const [mousePos, setMousePos] = useState([0, 0]); - const [isDescVisible, setisDescVisible] = useState(true); - - function handleMouseMove(e: MouseEvent) { - const top = window.innerWidth / 2 - window.innerHeight / 2; - setMousePos([e.clientX, e.clientY]); - } - - useEffect(() => { - window.addEventListener("mousemove", handleMouseMove); - return () => { - window.removeEventListener("mousemove", handleMouseMove); - }; - }, []); - - function handleOnMouseOut( - event: MouseEvent - ): void { - throw new Error("Function not implemented."); - } - function handleOnMouseOver( - event: MouseEvent - ): void { - console.log("event", event); - } +interface FloorWestWingHighlightingProps { + handleOnMouseOut: () => void; + handleOnMouseOver: () => void; +} +const FloorWestWingHighlighting = ({ + handleOnMouseOut, + handleOnMouseOver, +}: FloorWestWingHighlightingProps) => { return ( <> -
- -
- , - {/* {createPortal( - document.body - )} */} { viewBox="0 0 645 269" > { { { { { { { { { { { { { > { > { > - + - ); diff --git a/src/components/complexWingPage/SkygardenDescription.tsx b/src/components/complexWingPage/SkygardenDescription.tsx index 2e11d5e..341abd8 100644 --- a/src/components/complexWingPage/SkygardenDescription.tsx +++ b/src/components/complexWingPage/SkygardenDescription.tsx @@ -1,31 +1,33 @@ const SkygardenDescription = () => { return ( -
-
-
-

- Sky Garden -

-
- 17 amenties +
+
+
+
+

+ Sky Garden +

+
+ 17 amenties +
-
-
-
-

Indoor

-

3 amenties

-
-
-

Outdoor

+
+
+

Indoor

+

3 amenties

+
+
+

Outdoor

-

14 amenties

+

14 amenties

+
+
-
); diff --git a/src/index.css b/src/index.css index ffddb23..4eafcc7 100644 --- a/src/index.css +++ b/src/index.css @@ -18,6 +18,10 @@ html { } @layer components { + .desc-shadow { + box-shadow: 0px 4px 20px 1px #00000026; + } + .text-caption-s { font-family: "Usual", sans-serif; font-size: clamp(10px, 0.3744rem + 0.313vw, 12px);