'use client'; import { Button, CodeIcon, SparklesIcon, UsersIcon, } from '@imphnen-frontend-service/shadcn-ui/atoms'; import { formatCMSImageDataToMedia } from 'apps/landing/src/lib/format'; import { HeroSection } from 'apps/landing/src/payload-types'; import { motion } from 'framer-motion'; import Image from 'next/image'; import { Fragment, useEffect, useState } from 'react'; export function Hero(props: HeroSection) { const { badgeText, buttons, description, highlight, title, stats, heroImage, } = props; const [scrollY, setScrollY] = useState(0); useEffect(() => { const handleScroll = () => { setScrollY(window.scrollY); }; window.addEventListener('scroll', handleScroll); return () => window.removeEventListener('scroll', handleScroll); }, []); return (
{badgeText}

{title}
{highlight}

{description}

{stats?.map(({ value, label }, i) => (
{value}
{label}
{i < stats.length - 1 && (
)} ))}
{(() => { const media = formatCMSImageDataToMedia(heroImage); if (!media) return null; return ( {media.alt} ); })()}
); }