From b8ae853dd6eb635d1238ce617157170bb9e73ee2 Mon Sep 17 00:00:00 2001 From: Matt Webster Date: Fri, 19 Mar 2021 12:37:57 -0700 Subject: [PATCH] [CMPT] Switch to hosted Contact web form Fixes #864 - added Formspree - new menu item and route --- client/.eslintrc.js | 5 ++ client/Routes.jsx | 2 + client/components/Header.jsx | 3 + client/components/main/ContactForm.jsx | 99 ++++++++++++++++++++++++++ client/package-lock.json | 36 ++++++++++ client/package.json | 1 + 6 files changed, 146 insertions(+) create mode 100644 client/components/main/ContactForm.jsx diff --git a/client/.eslintrc.js b/client/.eslintrc.js index 327461d76..053f0736b 100644 --- a/client/.eslintrc.js +++ b/client/.eslintrc.js @@ -47,6 +47,11 @@ module.exports = { roles: ["tabpanel"], }, ], + "jsx-a11y/label-has-associated-control": [ 2, { + "labelComponents": ["label"], + "labelAttributes": ["htmlFor"], + "controlComponents": ["input"] + }], "react/jsx-filename-extension": [1, { extensions: [".js", ".jsx"] }], }, }; diff --git a/client/Routes.jsx b/client/Routes.jsx index f7bed0a92..c10e936d4 100644 --- a/client/Routes.jsx +++ b/client/Routes.jsx @@ -5,6 +5,7 @@ import Reports from '@components/main/Reports'; import Privacy from '@components/main/Privacy'; import Faqs from '@components/main/Faqs'; import Blog from '@components/main/Blog'; +import ContactForm from '@components/main/ContactForm'; export default function Routes() { return ( @@ -14,6 +15,7 @@ export default function Routes() { + diff --git a/client/components/Header.jsx b/client/components/Header.jsx index 96c6cd836..cb1776dec 100644 --- a/client/components/Header.jsx +++ b/client/components/Header.jsx @@ -106,6 +106,9 @@ const Header = () => { + + + ); diff --git a/client/components/main/ContactForm.jsx b/client/components/main/ContactForm.jsx new file mode 100644 index 000000000..379e7b306 --- /dev/null +++ b/client/components/main/ContactForm.jsx @@ -0,0 +1,99 @@ +import React from 'react'; +import { useForm } from '@formspree/react'; +import { + makeStyles, + Container, + Grid, + Button, +} from '@material-ui/core'; + +const useStyles = makeStyles({ + root: { + color: 'black', + backgroundColor: 'white', + minHeight: '40em', + padding: '2em', + '& h1': { + fontSize: '2.5em', + }, + '& img': { + maxWidth: '100%', + height: 'auto', + display: 'block', + marginLeft: 'auto', + marginRight: 'auto', + }, + '& label': { + marginTop: '1em', + fontWeight: 500, + display: 'block', + width: '20em', + }, + '& input': { + width: '40em', + padding: '0.5em', + }, + '& textarea': { + width: '40em', + padding: '0.5em', + }, + }, +}); + +const FORMSPREE_FORM_ID = 'xknkwwez'; + +const ContactForm = () => { + const [state, handleSubmit] = useForm(FORMSPREE_FORM_ID); + const classes = useStyles(); + + React.useEffect(() => { + console.log(state); + }); + + return ( + + + +

Contact Us

+ { state.succeeded + && ( +
+ Thank you for signing up! We will get back to you in 2-3 business days. +
+ )} + { !state.succeeded + && ( + <> +
+ Don't See What You Need? + We want to build a tool that works for you. + We are open to suggestions and feedback and would love the opportunity + to get connected. + Feel free to input your information in the contact form below + and we will be sure to get back to you within 2-3 business days. +
+
+
+ + +
+
+ + +
+
+ +