import React, { useRef, useState } from 'react' import { LazyMotion, domAnimation, m, useInView } from 'framer-motion' import { INITIAL_BOTTOM, getAnimation } from '~/lib/animations' import Panel from '~/components/Panel' import SectionContainer from '~/components/Layouts/SectionContainer' interface Highlight { image?: React.ReactNode svg?: React.ReactNode title: string paragraph: string | React.ReactNode } const HighlightCards = ({ highlights }: { highlights: Highlight[] }) => { return ( {highlights.map((highlight, i) => ( ))} ) } const HighlightCard = ({ highlight, index }: { highlight: Highlight; index: number }) => { const ref = useRef(null) const [isHovered, setIsHovered] = useState(false) const isInView = useInView(ref, { once: true }) const initial = INITIAL_BOTTOM const animate = getAnimation({ delay: 0.4 + index * 0.1 }) const Img: any = highlight.image return ( setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} animate={isInView ? animate : initial} > {highlight.image && } {highlight.svg && highlight.svg} {highlight.title} {highlight.paragraph} ) } export default HighlightCards
{highlight.paragraph}