import { Container, Flex } from '@chakra-ui/react'; import { useCallback, useRef } from 'react'; import { isSafari } from 'react-device-detect'; import { If, Then } from 'react-if'; import { Debugger, Footer, Greeting, Header, ResetButton } from '~/components'; import { useConfig } from '~/context'; import { motionChakra } from '~/elements'; import { useFormState } from '~/hooks'; import type { FlexProps } from '@chakra-ui/react'; const Main = motionChakra('main', { baseStyle: { px: 4, py: 0, w: '100%', display: 'flex', flex: '1 1 auto', flexDir: 'column', textAlign: 'center', alignItems: 'center', justifyContent: 'start', }, }); export const Layout = (props: FlexProps): JSX.Element => { const { developerMode } = useConfig(); const { setStatus, reset } = useFormState( useCallback(({ setStatus, reset }) => ({ setStatus, reset }), []), ); const containerRef = useRef({} as HTMLDivElement); async function handleReset() { containerRef.current.scrollIntoView({ behavior: 'smooth', block: 'start' }); setStatus('form'); reset(); } return ( <>
{props.children}