Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | 'use client' import { useEffect, useRef } from 'react' import { AbacusReact, useAbacusConfig, ABACUS_THEMES } from '@soroban/abacus-react' import { css } from '../../styled-system/css' import { useHomeHero } from '../contexts/HomeHeroContext' export function HeroAbacus() { const { subtitle, abacusValue, setAbacusValue, setIsHeroVisible, isAbacusLoaded, isSubtitleLoaded, } = useHomeHero() const appConfig = useAbacusConfig() const heroRef = useRef<HTMLDivElement>(null) // Use theme preset from abacus-react instead of manual definition const structuralStyles = ABACUS_THEMES.light // Detect when hero scrolls out of view useEffect(() => { if (!heroRef.current) return const observer = new IntersectionObserver( ([entry]) => { // Hero is visible if more than 20% is in viewport setIsHeroVisible(entry.intersectionRatio > 0.2) }, { threshold: [0, 0.2, 0.5, 1], } ) observer.observe(heroRef.current) return () => observer.disconnect() }, [setIsHeroVisible]) return ( <div ref={heroRef} className={css({ height: '100vh', display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'space-between', bg: 'gray.900', position: 'relative', overflow: 'hidden', px: '4', py: '12', })} > {/* Background pattern */} <div className={css({ position: 'absolute', inset: 0, opacity: 0.1, backgroundImage: 'radial-gradient(circle at 2px 2px, rgba(255, 255, 255, 0.15) 1px, transparent 0)', backgroundSize: '40px 40px', })} /> {/* Title and Subtitle Section - DIRECT CHILD */} <div className={css({ position: 'relative', display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '2', zIndex: 10, })} > <h1 className={css({ fontSize: { base: '4xl', md: '6xl', lg: '7xl' }, fontWeight: 'bold', background: 'linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #fbbf24 100%)', backgroundClip: 'text', color: 'transparent', })} > Abaci One </h1> <p className={css({ fontSize: { base: 'xl', md: '2xl' }, fontWeight: 'medium', color: 'purple.300', fontStyle: 'italic', marginBottom: '8', opacity: isSubtitleLoaded ? 1 : 0, transition: 'opacity 0.5s ease-in-out', })} > {subtitle.text} </p> </div> {/* Large Interactive Abacus - DIRECT CHILD */} <div className={css({ position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'center', flex: '1', width: '100%', zIndex: 10, opacity: isAbacusLoaded ? 1 : 0, transition: 'opacity 0.5s ease-in-out', })} > <div className={css({ transform: { base: 'scale(3.5)', md: 'scale(3.5)', lg: 'scale(4.25)', }, transformOrigin: 'center center', transition: 'all 0.5s cubic-bezier(0.4, 0, 0.2, 1)', })} > <AbacusReact value={abacusValue} columns={4} beadShape={appConfig.beadShape} showNumbers={true} interactive={true} animated={true} customStyles={structuralStyles} onValueChange={(v) => setAbacusValue(Number(v))} /> </div> </div> {/* Subtle hint to scroll - DIRECT CHILD */} <div className={css({ position: 'relative', fontSize: 'sm', color: 'gray.400', display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '2', animation: 'bounce 2s ease-in-out infinite', zIndex: 10, })} > <span>Scroll to explore</span> <span>↓</span> </div> {/* Keyframes for bounce animation */} <style dangerouslySetInnerHTML={{ __html: ` @keyframes bounce { 0%, 100% { transform: translateY(0); opacity: 0.7; } 50% { transform: translateY(-10px); opacity: 1; } } `, }} /> </div> ) } |