From 891441a76173c708c6604fa203b175aefa222333 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Mon, 9 Oct 2023 16:31:00 +0200 Subject: refactor(components): rewrite Branding component The component should only be responsible of the layout for the logo, the name and the optional baseline. Also, the homepage url could be different from `/` so the consumer should give the right url. --- src/components/templates/layout/layout.tsx | 68 +++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 16 deletions(-) (limited to 'src/components/templates/layout/layout.tsx') diff --git a/src/components/templates/layout/layout.tsx b/src/components/templates/layout/layout.tsx index 3e1eb63..25dcf4a 100644 --- a/src/components/templates/layout/layout.tsx +++ b/src/components/templates/layout/layout.tsx @@ -7,6 +7,7 @@ import { type ReactNode, useRef, useState, + type CSSProperties, } from 'react'; import { useIntl } from 'react-intl'; import type { Person, SearchAction, WebSite, WithContext } from 'schema-dts'; @@ -17,7 +18,7 @@ import { useScrollPosition, useSettings, } from '../../../utils/hooks'; -import { ButtonLink, Icon, Logo, Main } from '../../atoms'; +import { ButtonLink, Heading, Icon, Logo, Main } from '../../atoms'; import { SiteFooter, type SiteFooterProps, @@ -25,16 +26,23 @@ import { type SiteHeaderProps, } from '../../organisms'; import styles from './layout.module.scss'; +import { FlippingLogo } from 'src/components/molecules'; export type QueryAction = SearchAction & { 'query-input': string; }; -export type LayoutProps = Pick & { +export type LayoutProps = { /** * The layout main content. */ children: ReactNode; + /** + * Is it homepage? + * + * @default false + */ + isHome?: boolean; /** * Determine if article has a comments section. */ @@ -230,6 +238,15 @@ export const Layout: FC = ({ useRouteChange(giveFocusToTopRef); + const brandingTitleStyles = { + '--typing-animation': + 'blink 0.7s ease-in-out 0s 2, typing 4.3s linear 0s 1', + } as CSSProperties; + const brandingBaselineStyles = { + '--typing-animation': + 'hide-text 4.25s linear 0s 1, blink 0.8s ease-in-out 4.25s 2, typing 3.8s linear 4.25s 1', + } as CSSProperties; + return ( <>