diff --git a/src/components/AboutMarasiDrive.tsx b/src/components/AboutMarasiDrive.tsx index 73096c3..3c7ca98 100644 --- a/src/components/AboutMarasiDrive.tsx +++ b/src/components/AboutMarasiDrive.tsx @@ -3,13 +3,14 @@ import { marasiDriveDescriptionBadges, marasiDriveMapCards, } from "../data/aboutMarasiDrive"; -import MarariDriveNeighboursSlider from "./MarasiDriveNeighboursSlider"; +import MarariDriveNeighboursSliderDesktop from "./MarasiDriveNeighboursSliderDesktop"; import MarasiDriveInteriorsSlider from "./MarasiDriveInteriorsSlider"; import TextBox from "./ui/TextBox"; import { useRef } from "react"; import { useScroll } from "motion/react"; import MarasiDriveMapCard from "./MarasiDriveMapCard"; import BrochureButton from "./ui/BrochureButton"; +import MarasiDriveNeighboursSliderTablet from "./MarasiDriveNeighboursSliderTablet"; function AboutMarasiDrive() { const target = useRef(null); @@ -178,11 +179,16 @@ function AboutMarasiDrive() { />
+<<<<<<< HEAD
+======= +
+
+>>>>>>> a525a4a9481a4a4b333e73abb9a0e85f94286184

{`Explore the neighbourhood`}

@@ -192,7 +198,10 @@ function AboutMarasiDrive() { at Rove Home Marasi Drive!`}

- + +
diff --git a/src/components/MarasiDriveInteriorsSlider.tsx b/src/components/MarasiDriveInteriorsSlider.tsx index 686d8ac..773e877 100644 --- a/src/components/MarasiDriveInteriorsSlider.tsx +++ b/src/components/MarasiDriveInteriorsSlider.tsx @@ -24,21 +24,40 @@ function MarasiDriveInteriorsSlider() { }); return ( -
+
= 1440 + ? `translateX(calc(5vw - ${currentIndex - 1} * 27.222vw))` + : `translateX(calc(-33.333vw + 12px - ${ + currentIndex - 1 + } * 51.042vw))`, }} > {marasiDriveInspiredInteriors.map(({ image, name }, index) => ( = 1440 + ? index === currentIndex + ? "31.111vw" + : "20.556vw" + : index === currentIndex + ? "58.333vw" + : "38.542vw", }} exit={{ - width: index !== currentIndex ? "31.111vw" : "20.556vw", + width: + innerWidth >= 1440 + ? index !== currentIndex + ? "31.111vw" + : "20.556vw" + : index !== currentIndex + ? "58.333vw" + : "38.542vw", }} key={name} className="shrink-0" @@ -46,9 +65,16 @@ function MarasiDriveInteriorsSlider() { = 1440 + ? index !== currentIndex + ? "1.667vw" + : "2.222vw" + : index !== currentIndex + ? "32px" + : "24px", }} onClick={() => setCurrentIndex(index)} /> @@ -68,25 +94,25 @@ function MarasiDriveInteriorsSlider() { onlyIcon disabled={currentIndex === 0} onClick={() => setCurrentIndex(Math.max(currentIndex - 1, 0))} - className="!bg-[#F3F3F2] absolute 2xl:left-[27.778vw] top-[15.833vw]" + className="absolute 2xl:left-[27.778vw] left-[12.5vw] 2xl:top-[15.833vw] max-2xl:bottom-1/2" > - +
- +
); diff --git a/src/components/MarasiDriveNeighboursSlider.tsx b/src/components/MarasiDriveNeighboursSliderDesktop.tsx similarity index 75% rename from src/components/MarasiDriveNeighboursSlider.tsx rename to src/components/MarasiDriveNeighboursSliderDesktop.tsx index 6a4942f..ec51838 100644 --- a/src/components/MarasiDriveNeighboursSlider.tsx +++ b/src/components/MarasiDriveNeighboursSliderDesktop.tsx @@ -6,7 +6,7 @@ import { } from "motion/react"; import { marasiDriveNeighbours } from "../data/aboutMarasiDrive"; -function MarariDriveNeighboursSlider({ +function MarariDriveNeighboursSliderDesktop({ scrollYProgress, }: { scrollYProgress: MotionValue; @@ -39,20 +39,20 @@ function MarariDriveNeighboursSlider({ return ( {marasiDriveNeighbours.map(({ name, image }, index) => ( {name}

{name}

@@ -62,4 +62,4 @@ function MarariDriveNeighboursSlider({ ); } -export default MarariDriveNeighboursSlider; +export default MarariDriveNeighboursSliderDesktop; diff --git a/src/components/MarasiDriveNeighboursSliderTablet.tsx b/src/components/MarasiDriveNeighboursSliderTablet.tsx new file mode 100644 index 0000000..51d8671 --- /dev/null +++ b/src/components/MarasiDriveNeighboursSliderTablet.tsx @@ -0,0 +1,100 @@ +import { AnimatePresence, motion } from "motion/react"; +import { useState } from "react"; +import { useSwipeable } from "react-swipeable"; +import { marasiDriveNeighbours } from "../data/aboutMarasiDrive"; +import Button from "./ui/Button"; +import ChevronLeftIcon from "./icons/ChevronLeftIcon"; +import clsx from "clsx"; +import ChevronRightIcon from "./icons/ChevronRightIcon"; + +function MarasiDriveNeighboursSliderTablet() { + const [currentIndex, setCurrentIndex] = useState(1); + + const handlers = useSwipeable({ + onSwipedLeft: () => + setCurrentIndex( + Math.min(currentIndex + 1, marasiDriveNeighbours.length - 1) + ), + onSwipedRight: () => setCurrentIndex(Math.max(currentIndex - 1, 0)), + preventScrollOnSwipe: true, + touchEventOptions: { + passive: false, + }, + trackMouse: true, + }); + + return ( +
+ + + {marasiDriveNeighbours.map(({ image, name }, index) => ( + + setCurrentIndex(index)} + /> +

+ {name} +

+
+ ))} +
+
+ + +
+ ); +} + +export default MarasiDriveNeighboursSliderTablet;