Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contact form #22

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 152 additions & 4 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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 {
Expand Down Expand Up @@ -429,14 +568,23 @@ button ion-icon {
a.mobile-navigation-button {
background-color: var(--blue);
color: var(--white);
gap: 10px;
}

a.mobile-navigation-button:hover {
background-color: var(--bluer);
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;
Expand Down
54 changes: 41 additions & 13 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -28,6 +29,14 @@ const App: FC<AppProps> = ({ 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 = (
Expand All @@ -41,6 +50,7 @@ const App: FC<AppProps> = ({ user, classItems }): JSX.Element => {

return (
<div className="App">
<Contact />
<div className="container">
<div className="navigation">
<ul>
Expand Down Expand Up @@ -84,15 +94,15 @@ const App: FC<AppProps> = ({ user, classItems }): JSX.Element => {
href={links.github}
target="_blank"
rel="noopener noreferrer"
aria-label="Magnify GitHub"
title="Magnify GitHub"
aria-label="GitHub"
title="GitHub"
>
<span className="icon">
{/* @ts-expect-error ts(2339) */}
<ion-icon
name="logo-github"
aria-label="Magnify GitHub"
title="Magnify GitHub"
aria-label="GitHub"
title="GitHub"
/>
</span>
<span className="title">GitHub</span>
Expand Down Expand Up @@ -263,15 +273,26 @@ const App: FC<AppProps> = ({ user, classItems }): JSX.Element => {
</div>
<div id="course-container">{classItems}</div>
</div>
<button
type="button"
onClick={scrollToTop}
id="to-top"
className="jump-to-top"
>
{/* @ts-expect-error ts(2339) */}
<ion-icon name="chevron-up-outline" size="larger" />
</button>
<div className="floating-button-container">
<button
type="button"
onClick={scrollToTop}
id="to-top"
className="jump-to-top"
>
{/* @ts-expect-error ts(2339) */}
<ion-icon name="chevron-up-outline" size="larger" />
</button>
<button
type="button"
onClick={openContact}
id="contact-modal-open"
className="contact-modal-button"
>
{/* @ts-expect-error ts(2339) */}
<ion-icon name="mail-outline" size="larger" />
</button>
</div>
<div id="mobile-nav" className="mobile-navigation">
<a
href={links.programOfStudiesPDF}
Expand All @@ -289,6 +310,13 @@ const App: FC<AppProps> = ({ user, classItems }): JSX.Element => {
>
GitHub
</a>
<button
type="button"
onClick={openContact}
className="mobile-navigation-button mobile-contact-modal-button"
>
Contact
</button>
<button
type="button"
onClick={scrollToTop}
Expand Down
Loading