From cd42988a906c4849b8491f70e34c817306cc3f67 Mon Sep 17 00:00:00 2001 From: Matchu Date: Wed, 7 Oct 2020 09:48:55 -0700 Subject: [PATCH] add beta blurb & WIP feedback form to homepage --- src/app/HomePage.js | 196 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) diff --git a/src/app/HomePage.js b/src/app/HomePage.js index bcea051..b135b1f 100644 --- a/src/app/HomePage.js +++ b/src/app/HomePage.js @@ -5,11 +5,14 @@ import { Box, Button, Flex, + IconButton, Input, + Textarea, useColorModeValue, useTheme, useToast, } from "@chakra-ui/core"; +import { CloseIcon } from "@chakra-ui/icons"; import { useHistory, useLocation } from "react-router-dom"; import { useLazyQuery } from "@apollo/client"; @@ -64,6 +67,8 @@ function HomePage() { + + ); } @@ -241,6 +246,197 @@ function SubmitPetForm() { ); } +function FeedbackFormSection() { + const [isOpen, setIsOpen] = React.useState(false); + const borderColor = useColorModeValue("gray.300", "blue.400"); + + const openButtonRef = React.useRef(null); + const emailFieldRef = React.useRef(null); + + React.useLayoutEffect(() => { + if (isOpen) { + if (emailFieldRef.current) { + emailFieldRef.current.focus(); + } + } else { + if (openButtonRef.current) { + openButtonRef.current.focus(); + } + } + }, [isOpen]); + + return ( + setIsOpen(true))} + > + + + + + + } + size="xs" + variant="ghost" + onClick={() => setIsOpen(false)} + isDisabled={!isOpen} + /> + + + setIsOpen(true)} + openButtonRef={openButtonRef} + /> + + + setIsOpen(false)} + emailFieldRef={emailFieldRef} + /> + + + + ); +} + +function FeedbackFormPitch({ isDisabled, onClick, openButtonRef }) { + return ( + + Hi friends! Welcome to the beta! + + This is the new Dress to Impress! It's ready for the future, and it even + works great on mobile! More coming soon! + + + Tell us what you think → + + + ); +} + +function FeedbackForm({ isDisabled, onClose, emailFieldRef }) { + const [content, setContent] = React.useState(""); + const toast = useToast(); + + return ( + { + e.preventDefault(); + toast({ + title: "Ah, well, this form isn't hooked up yet!", + description: + "That's coming soon! 😅 For now, please send an email to matchu@openneo.net. Sorry and thanks!", + duration: null, + isClosable: true, + }); + }} + onKeyDown={(e) => { + if (e.key === "Escape") { + onClose(); + e.stopPropagation(); + } + }} + > + +