import { useState, useEffect } from 'react' import { useTranslation } from 'next-i18next' import { AaronFront, AaronBack } from 'shared/components/designs/linedrawings/aaron.mjs' import { BruceFront, BruceBack } from 'shared/components/designs/linedrawings/bruce.mjs' import { SimonFront, SimonBack } from 'shared/components/designs/linedrawings/simon.mjs' import { WahidFront, WahidBack } from 'shared/components/designs/linedrawings/wahid.mjs' export const ns = ['homepage'] const lineDrawings = [ , , , , , , , , ] const patternTweaks = [ , , , , , , , , ] const Pattern = ({ i }) => ( {patternTweaks[i]} ) const Nr = ({ nr }) => (
{nr}
) const Title = ({ txt }) => (

{txt}

) const slides = [0, 1, 2, 3, 4, 5, 6, 7] export const HowDoesItWorkAnimation = ({ className = 'w-full', stroke = 0.3 }) => { const { t } = useTranslation(ns) const [step, setStep] = useState(0) const [halfStep, setHalfStep] = useState(0) useEffect(() => { setTimeout(() => { if (step > 6) setStep(0) else setStep(step + 1) if (halfStep > 7) setHalfStep(0) else setHalfStep(halfStep + 0.5) }, 800) }, [step]) return (
{slides.map((i) => (
{lineDrawings[i]}
))}
</div> <div className="relative w-full"> <div className="relative h-72 md:h-96 overflow-hidden"> {slides.map((i) => ( <div key={i} className={`duration-700 ease-in-out transition-all ${ Math.floor(halfStep) === i ? 'opacity-1' : 'opacity-0' } absolute top-0 text-center w-full`} > <div className="w-full flex flex-row items-center h-72 md:h-96 w-full justify-center"> <img src={`/img/models/model-${i}.png`} className="h-72 md:h-96 shrink-0 px-8" /> </div> </div> ))} <Nr nr={2} /> <Title txt={t('addASet')} /> </div> </div> <div className="relative w-full"> <div className="relative h-96 overflow-hidden"> <div className="w-full flex flex-row items-center h-72 md:h-96 w-full justify-center"> <Pattern key={step} i={step} /> </div> <Nr nr={3} /> <Title txt={t('customizeYourPattern')} /> </div> </div> </div> ) }