import React, { useEffect, useState } from 'react'; import Image from 'next/image'; const HeroBanner = () => { const options = ['Bitcoin', 'Lightning', 'Nostr']; const [currentOption, setCurrentOption] = useState(0); const [isFlipping, setIsFlipping] = useState(false); const getColorClass = (option) => { switch (option) { case 'Bitcoin': return 'text-orange-400'; case 'Lightning': return 'text-blue-500'; case 'Nostr': return 'text-purple-400'; default: return 'text-white'; } }; useEffect(() => { const interval = setInterval(() => { setIsFlipping(true); setTimeout(() => { setCurrentOption((prevOption) => (prevOption + 1) % options.length); setTimeout(() => { setIsFlipping(false); }, 400); // Start preparing to flip back a bit before the halfway point }, 400); // Update slightly before the midpoint for smoother transition }, 2500); // Increased to provide a slight pause between animations for readability return () => clearInterval(interval); }, []); return (
Learn how to code
Build{' '} {options[currentOption]} {' '}apps
Become a Bitcoin developer