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