"use client"; import { useEffect, useRef } from "react"; import { motion } from "framer-motion"; import Image from "next/image"; import Section from "./Section"; import { useInstagram } from "@/hooks/useInstagram"; export default function SocialMedia() { const { posts, loading, error, isTokenExpired } = useInstagram(); const scrollRef = useRef(null); const fadeInUp = { initial: { opacity: 0, y: 30 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.8, ease: [0.25, 0.46, 0.45, 0.94] }, }; const fadeInLeft = { initial: { opacity: 0, x: -30 }, animate: { opacity: 1, x: 0 }, transition: { duration: 0.8, ease: [0.25, 0.46, 0.45, 0.94] }, }; const fadeInRight = { initial: { opacity: 0, x: 30 }, animate: { opacity: 1, x: 0 }, transition: { duration: 0.8, ease: [0.25, 0.46, 0.45, 0.94] }, }; useEffect(() => { // Only auto-scroll on mobile (<768px) if (window.innerWidth >= 768) return; const container = scrollRef.current; if (!container) return; let scrollAmount = 0; const cardWidth = container.firstElementChild?.clientWidth || 300; const scrollStep = cardWidth + 16; // 16px gap between items let direction = 1; // 1 = right, -1 = left const interval = setInterval(() => { if (!container) return; scrollAmount += scrollStep * direction; // Reverse direction if hitting ends if ( scrollAmount >= container.scrollWidth - container.clientWidth || scrollAmount <= 0 ) { direction *= -1; } container.scrollTo({ left: scrollAmount, behavior: "smooth", }); }, 3000); // scroll every 3s return () => clearInterval(interval); }, []); return (

Follow us on Instagram

{loading ? ( <> {[1, 2, 3].map((i) => ( ))} ) : error ? ( isTokenExpired ? (
🔗

Instagram Connection Expired

Our Instagram connection needs to be refreshed. We're working on getting it back up!

In the meantime, follow us @mozimo_chocolate
) : ( <> {/* Left Block - Chocolate Spread Jar */}
🍫
MOZIMO
SINGLE ORIGIN HAZELNUT SPREAD 45%
{/* Middle Block - Magazine Article */}
🍫
🍰
👨‍🍳

By RUPALI DEAN

MOZIMO'S CHOCOLATE PIE BY PRIYANKA GUPTA

isolat[ing] beans to not only single ori- but also to single farms so as to express unique complexity.

{/* Right Block - World Chocolate Day */}

World Chocolate Day

Celebrating the art of chocolate making

🍫

Join us in celebrating the world's favorite treat

) ) : ( posts?.slice(0, 3).map((post, index) => (
); }