import { Flex, Button, VStack } from '@chakra-ui/react'; import { motion } from 'framer-motion'; import { If } from '~/components'; import { useConfig, useMobile } from '~/context'; import { useBooleanValue, useLGState } from '~/hooks'; import { Logo } from './logo'; import { TitleOnly } from './titleOnly'; import { useHeaderCtx } from './context'; import { SubtitleOnly } from './subtitleOnly'; import type { StackProps } from '@chakra-ui/react'; import type { TTitle, TTitleWrapper, TDWrapper } from './types'; const AnimatedVStack = motion.custom(VStack); /** * Title wrapper for mobile devices, breakpoints sm & md. */ const MWrapper = (props: StackProps) => ; /** * Title wrapper for desktop devices, breakpoints lg & xl. */ const DWrapper = (props: TDWrapper) => { const { showSubtitle } = useHeaderCtx(); return ( ); }; /** * Universal wrapper for title sub-components, which will be different depending on the * `title_mode` configuration variable. */ const TitleWrapper = (props: TDWrapper | StackProps) => { const isMobile = useMobile(); return ( <> {isMobile ? : } ); }; /** * Title sub-component if `title_mode` is set to `text_only`. */ const TextOnly = (props: TTitleWrapper) => { return ( ); }; /** * Title sub-component if `title_mode` is set to `logo_only`. Renders only the logo. */ const LogoOnly = () => ( ); /** * Title sub-component if `title_mode` is set to `logo_subtitle`. Renders the logo with the * subtitle underneath. */ const LogoSubtitle = () => ( ); /** * Title sub-component if `title_mode` is set to `all`. Renders the logo, title, and subtitle. */ const All = () => ( ); /** * Title component which renders sub-components based on the `title_mode` configuration variable. */ export const Title = (props: TTitle) => { const { fontSize, ...rest } = props; const { web } = useConfig(); const titleMode = web.text.title_mode; const { isSubmitting, resetForm } = useLGState(); const titleHeight = useBooleanValue(isSubmitting.value, undefined, { md: '20vh' }); function handleClick(): void { isSubmitting.set(false); resetForm(); } return ( ); };