import React, { useRef, useState } from "react"; import { Flex, useColorMode } from "@chakra-ui/core"; import { motion, AnimatePresence } from "framer-motion"; import HyperglassForm from "~/components/HyperglassForm"; import Results from "~/components/Results"; import Header from "~/components/Header"; import Footer from "~/components/Footer"; import Meta from "~/components/Meta"; import useConfig from "~/components/HyperglassProvider"; import Debugger from "~/components/Debugger"; const AnimatedForm = motion.custom(HyperglassForm); const bg = { light: "white", dark: "black" }; const color = { light: "black", dark: "white" }; const headerHeightDefault = { true: [16, 16, 16, 16], false: [24, 64, 64, 64] }; const headerHeightAll = { true: [32, 32, 32, 32], false: [48, "20rem", "20rem", "20rem"] }; const Layout = () => { const config = useConfig(); const { colorMode } = useColorMode(); const [isSubmitting, setSubmitting] = useState(false); const [formData, setFormData] = useState({}); const containerRef = useRef(null); const handleFormReset = () => { containerRef.current.scrollIntoView({ behavior: "smooth", block: "start" }); setSubmitting(false); }; const headerHeight = config.web.text.title_mode === "all" ? headerHeightAll[isSubmitting] : headerHeightDefault[isSubmitting]; return ( <>
{isSubmitting && formData && ( )} {!isSubmitting && ( )}