Newer
Older
Katarína Sieklová
committed
import {useRef} from 'react';
import {AnimateCC} from 'react-adobe-animate';
import Typewriter, {TypewriterClass} from "typewriter-effect";
import {diabetesTheorem, nextButton, opening, toTest} from "../../public/lit/texts";
Katarína Sieklová
committed
import {useAnimate} from "../hooks/useAnimate";
import {useTranslate} from "../hooks/useTranslate";
Katarína Sieklová
committed
const firstTheoremText = useTranslate(diabetesTheorem);
const nextButtonText = useTranslate(nextButton);
const testText = useTranslate(toTest);
const typewriterRef = useRef<TypewriterClass>();
Katarína Sieklová
committed
const {getAnimationObject, handleClick, isAnimationComplete, isLast, onInit, paused} = useAnimate({
typewriterRef,
link: '/InsulinTest',
Katarína Sieklová
committed
text: opening
});
Katarína Sieklová
committed
<p className="text-2xl bg-red-200 font-primary border border-red-800 w-max justify-self-center inline p-4 animate-fade-in">
{firstTheoremText}
</p>
</div>
<div className="flex items-center justify-center">
<div id="intro-text" className="font-speech max-w-md"
style={{position: 'absolute', top: 300, left: 150, right: 900}}>
<Typewriter
options={{
delay: 40,
}}
Katarína Sieklová
committed
onInit={(typewriter) => onInit({ typewriter, pauseFor: 3400 })}
/>
</div>
<div className="flex justify-center">
<div
id="animation-container"
>
<AnimateCC
animationName="opening"
getAnimationObject={getAnimationObject}
paused={paused}
/>
</div>
</div>
</div>
<div className="flex justify-center">
<button
onClick={handleClick}
className={`border-4 border-black font-primary ${
!isAnimationComplete ? 'bg-gray-main' : 'bg-yellow-main'
{isLast ? testText : nextButtonText}
</button>
</div>
</div>
</div>
</>
);
};
export default Opening;