From 8ca6696b3f9daa0d461652bb97867106ffe149d2 Mon Sep 17 00:00:00 2001 From: GoogleGenius <81032623+GoogleGenius@users.noreply.github.com> Date: Thu, 28 Jul 2022 14:46:45 -0500 Subject: [PATCH] Add contact form --- src/App.css | 156 +++++++++++++++++++++++++++++++- src/App.tsx | 54 ++++++++--- src/components/Contact.tsx | 109 ++++++++++++++++++++++ src/{ => components}/Course.tsx | 10 +- src/components/index.ts | 2 + src/config/formSubmit.ts | 3 + src/config/index.ts | 1 + src/index.tsx | 2 +- 8 files changed, 313 insertions(+), 24 deletions(-) create mode 100644 src/components/Contact.tsx rename src/{ => components}/Course.tsx (97%) create mode 100644 src/components/index.ts create mode 100644 src/config/formSubmit.ts diff --git a/src/App.css b/src/App.css index 8c539e9..d988dd9 100644 --- a/src/App.css +++ b/src/App.css @@ -356,6 +356,143 @@ button ion-icon { margin-right: 5px; } +.floating-button-container { + align-items: center; + bottom: 30px; + display: flex; + flex-direction: column; + gap: 10px; + justify-content: center; + position: fixed; + right: 30px; + z-index: 9; +} + +.modal { + align-content: center; + background-color: var(--white); + border: none; + border-radius: 25px; + box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, + rgba(0, 0, 0, 0.05) 0px 0px 0px 2px; + display: flex; + flex-direction: column; + font-size: smaller; + gap: clamp(15px, 5vw, 20px); + height: 100%; + margin: revert; + max-height: 500px; + max-width: 500px; + padding: clamp(15px, 5vw, 20px); + text-align: left; + width: 100%; +} + +.modal-form { + display: flex; + flex-direction: column; + gap: clamp(15px, 5vw, 20px); + height: 100%; + width: 100%; +} + +.modal-input { + border: none; + border-radius: 999px; + box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, + rgba(0, 0, 0, 0.05) 0px 0px 0px 2px; + outline: none; + padding: 15px; +} + +.modal-message { + border: none; + border-radius: 25px; + box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, + rgba(0, 0, 0, 0.05) 0px 0px 0px 2px; + height: 100%; + outline: none; + padding: 15px; + resize: none; +} + +.modal-button-container { + gap: clamp(15px, 5vw, 20px); +} + +.modal-send { + align-items: center; + background-color: var(--blue); + border: none; + border-radius: 999px; + color: var(--white); + cursor: pointer; + display: flex; + flex: 1 1; + padding: 15px; + text-decoration: none; + transition: all 0.5s ease 0s; + vertical-align: middle; +} + +.modal-send:hover { + background-color: var(--bluer); + color: var(--white); + transition: all 0.5s ease 0s; +} + +.modal-cancel { + align-items: center; + background-color: var(--blueish); + border: none; + border-radius: 999px; + color: var(--bluer); + cursor: pointer; + display: flex; + flex: 1 1; + padding: 15px; + text-decoration: none; + transition: all 0.5s ease 0s; + vertical-align: middle; +} + +.modal-cancel:hover { + background-color: var(--blue); + color: var(--white); + transition: all 0.5s ease 0s; +} + +.contact-modal-button { + align-items: center; + background-color: var(--blueish); + border: none; + border-radius: 999px; + /* bottom: 30px; */ + box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px; + color: var(--bluer); + cursor: pointer; + display: none; + height: 45.5px; + justify-content: center; + /* left: 110px; */ + padding: 10px; + /* position: fixed; */ + transition: all 0.5s ease 0s; + width: 45.5px; +} + +@media only screen and (min-width: 525px) { + .contact-modal-button { + display: flex; + } +} + +.contact-modal-button:hover { + background-color: var(--blue); + color: var(--white); + transition: all 0.5s ease 0s; +} + .hide { display: none; } @@ -365,18 +502,20 @@ button ion-icon { background-color: var(--blueish); border: none; border-radius: 999px; - bottom: 30px; + /* bottom: 30px; */ box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px; color: var(--bluer); cursor: pointer; display: flex; + height: 45.5px; justify-content: center; opacity: 0; padding: 10px; - position: fixed; - right: 30px; + /* position: fixed; */ + /* right: 30px; */ transition: all 0.5s ease 0s; visibility: hidden; + width: 45.5px; } .jump-to-top:hover { @@ -429,7 +568,6 @@ button ion-icon { a.mobile-navigation-button { background-color: var(--blue); color: var(--white); - gap: 10px; } a.mobile-navigation-button:hover { @@ -437,6 +575,16 @@ a.mobile-navigation-button:hover { color: var(--white); } +.mobile-contact-modal-button { + background-color: var(--blue); + color: var(--white); +} + +.mobile-contact-modal-button:hover { + background-color: var(--bluer); + color: var(--white); +} + @media only screen and (min-width: 525px) { .mobile-navigation { display: none; diff --git a/src/App.tsx b/src/App.tsx index 5aefaf8..9f3d434 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,5 @@ import './App.css'; +import { Contact } from './components'; import { links } from './data'; import { scrollToTop } from './utils'; import firebase from 'firebase/compat/app'; @@ -28,6 +29,14 @@ const App: FC = ({ user, classItems }): JSX.Element => { } }, []); + const openContact = useCallback(() => { + const contactModal = document.getElementById( + 'contact-modal' + ) as HTMLDialogElement; + contactModal?.parentElement?.classList.remove('hide'); + contactModal?.showModal(); + }, []); + let userElement: JSX.Element; if (user && user.photoURL) { userElement = ( @@ -41,6 +50,7 @@ const App: FC = ({ user, classItems }): JSX.Element => { return (
+
    @@ -84,15 +94,15 @@ const App: FC = ({ user, classItems }): JSX.Element => { href={links.github} target="_blank" rel="noopener noreferrer" - aria-label="Magnify GitHub" - title="Magnify GitHub" + aria-label="GitHub" + title="GitHub" > {/* @ts-expect-error ts(2339) */} GitHub @@ -263,15 +273,26 @@ const App: FC = ({ user, classItems }): JSX.Element => {
{classItems}
- +
+ + +
= ({ user, classItems }): JSX.Element => { > GitHub +