/** @jsx jsx */ import { jsx } from '@emotion/core'; import { forwardRef } from 'react'; import { Button, Heading, Image, Stack, useColorMode } from '@chakra-ui/core'; import { useConfig, useMedia } from 'app/context'; const titleSize = { true: ['2xl', '2xl', '5xl', '5xl'], false: '2xl' }; const titleMargin = { true: 2, false: 0 }; const textAlignment = { false: ['right', 'center'], true: ['left', 'center'] }; const logoName = { light: 'dark', dark: 'light' }; const justifyMap = { true: ['flex-end', 'center', 'center', 'center'], false: ['flex-start', 'center', 'center', 'center'], }; const logoFallback = { light: 'https://res.cloudinary.com/hyperglass/image/upload/v1593916013/logo-dark.svg', dark: 'https://res.cloudinary.com/hyperglass/image/upload/v1593916013/logo-light.svg', }; const TitleOnly = ({ text, showSubtitle }) => ( {text} ); const SubtitleOnly = ({ text, mediaSize, ...props }) => ( {text} ); const TextOnly = ({ text, mediaSize, showSubtitle, ...props }) => ( {showSubtitle && } ); const Logo = ({ text, logo }) => { const { colorMode } = useColorMode(); const { width, dark_format, light_format } = logo; const logoExt = { light: dark_format, dark: light_format }; return ( {text.title} ); }; const LogoSubtitle = ({ text, logo, mediaSize }) => ( <> ); const All = ({ text, logo, mediaSize, showSubtitle }) => ( <> ); const modeMap = { text_only: TextOnly, logo_only: Logo, logo_subtitle: LogoSubtitle, all: All, }; export const Title = forwardRef(({ onClick, isSubmitting, ...props }, ref) => { const { web } = useConfig(); const { mediaSize } = useMedia(); const titleMode = web.text.title_mode; const MatchedMode = modeMap[titleMode]; return ( ); });