From 811190abd8c0c8b0162ca2e547912f53e6e2ef14 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Wed, 4 Mar 2026 12:07:01 -0800 Subject: [PATCH] fix: replace react-pageflip with simple single-slide viewer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drop the flipbook library — it couldn't reliably force single-page mode. Replace with a CSS translateX carousel that shows exactly one slide at a time with smooth transitions. Co-Authored-By: Claude Opus 4.6 --- components/sponsorship-flipbook.tsx | 92 ++++++++--------------------- 1 file changed, 26 insertions(+), 66 deletions(-) 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}