import { useSwipeable } from "react-swipeable"; import Button from "../../Button"; import CrossIcon from "../../icons/CrossIcon"; import { ISlider } from "../../../types/slide"; import { useState, useRef, useContext } from "react"; import LeftArrowSliderIcon from "../../icons/LeftArrowSliderIcon"; import RightArrowSliderIcon from "../../icons/RightArrowSliderIcon"; import { MobileModalWrapperContext } from "./MobileModalWrapper"; import useModal from "../../../store/useModal"; const tipsSlides: ISlider[] = [ { id: "tps-sld-1", src: "/images/masterplan/help/1.png", title: "1. Workspace", desc: "For more comfortable work with the general plan, size it to the full screen.", }, { id: "tps-sld-2", src: "/images/masterplan/help/1.png", title: "2. Filter on the master plan", desc: "Filter the apartments in the project by required parameters.", }, { id: "tps-sld-3", src: "/images/masterplan/help/1.png", title: "3. Take a closer look at the project", desc: "Learn more about the project, surrounding infrastructure and apartment features.", }, { id: "tps-sld-4", src: "/images/masterplan/help/1.png", title: "4. Look for apartments", desc: "Use the search to select an apartment that suits you, add it to your favorites and compare.", }, ]; const MobileHelpModal = () => { // const [imageWidth] = useState(0); const imageRef = useRef(null); const { setIsAnimate } = useContext(MobileModalWrapperContext); const [selectedImageIndex, setSelectedImageIndex] = useState(-1); const [rightImageOffset] = useState(""); const { setModal } = useModal(); const handlers = useSwipeable({ onSwipedDown: () => handleOnCloseClick(), onSwipedLeft: next, onSwipedRight: prev, }); const handleOnCloseClick = () => { if (setIsAnimate) { setIsAnimate(false); const timeout = setTimeout(() => { setModal(null); clearTimeout(timeout); }, 300); } }; function next() { const lastIndex = tipsSlides.length - 2; if (selectedImageIndex === lastIndex) return; // setSelectedImageIndex((prev) => prev + 1); } function prev() { if (selectedImageIndex === -1) return; setSelectedImageIndex((prev) => prev - 1); } // useLayoutEffect(() => { // const gapOffset = 45; // const _rightImageOffset = `${ // (selectedImageIndex + 1) * (imageWidth + gapOffset) // }px`; // setRightImageOffset(_rightImageOffset); // }, [imageWidth, selectedImageIndex, imageRef?.current?.width]); return (

Tips for working

{tipsSlides.map((image) => (

{image.title}

{image.desc}

))}
); // return
//
//
//
//

// Tips for working //

//
// 1 //
//

1. Workspace

//

// For more comfortable work with the general plan, size it to the // full screen. //

//
//
//
//
//
//
; }; export default MobileHelpModal;