From 54883bb5c36cf21462a421605a709fdd6f04b150 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 18 May 2022 11:44:37 +0200 Subject: chore: add branding animation --- src/components/molecules/layout/branding.tsx | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/components/molecules/layout/branding.tsx') diff --git a/src/components/molecules/layout/branding.tsx b/src/components/molecules/layout/branding.tsx index 423c54f..9a82a74 100644 --- a/src/components/molecules/layout/branding.tsx +++ b/src/components/molecules/layout/branding.tsx @@ -1,6 +1,7 @@ import Heading from '@components/atoms/headings/heading'; +import useStyles from '@utils/hooks/use-styles'; import Link from 'next/link'; -import { FC } from 'react'; +import { FC, useRef } from 'react'; import { useIntl } from 'react-intl'; import FlippingLogo, { type FlippingLogoProps } from '../images/flipping-logo'; import styles from './branding.module.scss'; @@ -37,6 +38,9 @@ const Branding: FC = ({ withLink = false, ...props }) => { + const baselineRef = useRef(null); + const logoRef = useRef(null); + const titleRef = useRef(null); const intl = useIntl(); const altText = intl.formatMessage( { @@ -55,6 +59,23 @@ const Branding: FC = ({ { website: title } ); + useStyles({ + property: '--typing-animation', + styles: 'blink 0.7s ease-in-out 0s 2, typing 4.3s linear 0s 1', + target: titleRef, + }); + useStyles({ + property: '--typing-animation', + styles: + 'hide-text 4.25s linear 0s 1, blink 0.8s ease-in-out 4.25s 2, typing 3.8s linear 4.25s 1', + target: baselineRef, + }); + useStyles({ + property: 'animation', + styles: 'flip-logo 9s ease-in 0s 1', + target: logoRef, + }); + return (
= ({ altText={altText} logoTitle={logoTitle} photo={photo} + ref={logoRef} {...props} /> = ({ level={1} withMargin={false} className={styles.title} + ref={titleRef} > {withLink ? ( @@ -84,6 +107,7 @@ const Branding: FC = ({ level={4} withMargin={false} className={styles.baseline} + ref={baselineRef} > {baseline} -- cgit v1.2.3