diff --git a/components/sponsorship-flipbook.tsx b/components/sponsorship-flipbook.tsx index d579036..c8aeaa0 100644 --- a/components/sponsorship-flipbook.tsx +++ b/components/sponsorship-flipbook.tsx @@ -1,99 +1,59 @@ "use client" -import React, { useRef, useState, useCallback } from "react" -import dynamic from "next/dynamic" +import { useState } from "react" import Image from "next/image" import { ChevronLeft, ChevronRight } from "lucide-react" import { Button } from "@/components/ui/button" -const HTMLFlipBook = dynamic(() => import("react-pageflip"), { ssr: false }) - const TOTAL_SLIDES = 12 -const Page = React.forwardRef( - function Page({ number }, ref) { - return ( -
- {`Sponsorship -
- ) - } -) - export default function SponsorshipFlipbook() { - const bookRef = useRef(null) - const [currentPage, setCurrentPage] = useState(0) + const [currentSlide, setCurrentSlide] = useState(0) - const onFlip = useCallback((e: any) => { - setCurrentPage(e.data) - }, []) - - const prevPage = () => bookRef.current?.pageFlip()?.flipPrev() - const nextPage = () => bookRef.current?.pageFlip()?.flipNext() + const prevSlide = () => setCurrentSlide((s) => Math.max(0, s - 1)) + const nextSlide = () => setCurrentSlide((s) => Math.min(TOTAL_SLIDES - 1, s + 1)) return (
-
- {/* @ts-expect-error react-pageflip types are incomplete */} - +
{Array.from({ length: TOTAL_SLIDES }, (_, i) => ( - +
+ {`Sponsorship +
))} - +
- {currentPage + 1} / {TOTAL_SLIDES} + {currentSlide + 1} / {TOTAL_SLIDES}