Skip to content

Commit

Permalink
fix: navbar menu button not showing
Browse files Browse the repository at this point in the history
  • Loading branch information
zeim839 committed Jun 22, 2024
1 parent 59e8206 commit 84294fc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 27 deletions.
22 changes: 1 addition & 21 deletions src/components/Index/ContactSection.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState } from "react"
import axios from "axios"

export type ContactFormInput = {
Email: string;
Expand All @@ -8,12 +7,6 @@ export type ContactFormInput = {
Subscribe: boolean;
}

// Mailchimp does not have embeddable contact forms. Instead of
// redirecting the user to another page, we implement our own
// contact form and manually route the request.
const MAILCHIMP_ENDPOINT = "https://us14.list-manage.com/contact-form/post?u=db783e723b7d1d98b155e95fb&form_id=80783a94938d6eda182e75cc327ece48"
const CORS_PROXY = "https://api.allorigins.win/post?url="

export default function ContactSection() {
type TextEvent = { target: { value: string }}
type CheckboxEvent = { target: { checked: boolean }}
Expand All @@ -32,20 +25,7 @@ export default function ContactSection() {

const onSubmit = (event: { preventDefault: Function }) => {
event.preventDefault()
axios.post(`${CORS_PROXY}${encodeURIComponent(MAILCHIMP_ENDPOINT)}`, {
fields: {
"1": form.Email,
"2": form.Subject,
"3": form.Message,
},
subscribe: form.Subscribe,
"mc-SMSPHONE-ack": false,
}).then((res) => {
console.log(res)
setForm({Email: "", Subject: "", Message: "", Subscribe: true})
}).catch((error) => {
console.log(error)
})
alert("Contact form is temporarily unavailable")
}

return (
Expand Down
9 changes: 7 additions & 2 deletions src/components/Navbar/Navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,18 @@
}

.menu-btn {
min-width: 0px;
margin-right: 30px;
height: 1rem;
background-color: transparent;
border: none;
outline: none;
}

.menu-btn:hover {
background: none;
}

.menu-btn img {
height: inherit;
}
Expand All @@ -103,7 +108,7 @@
}

/* ---- for devices under 730 px (tablet view) -------*/
@media only screen and (min-width: 600px) and (max-width: 730px) {
@media only screen and (min-width: 600px) and (max-width: 800px) {
#navbar-title {
font-size: 1rem;
}
Expand Down Expand Up @@ -151,7 +156,7 @@
}

/* ----- for devices under (mobile view)-------*/
@media only screen and (max-width: 600px) {
@media only screen and (max-width: 650px) {
#navigation-bar {
justify-content: flex-start;
gap: 0;
Expand Down
11 changes: 7 additions & 4 deletions src/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ const NavBar = (props: { children: any }) => {
const [showMenu, setShowMenu] = useState<boolean>(false)
const [forceShowMenu, setForceShowMenu] = useState<boolean>(false)
useEffect(() => {
if (window.innerWidth >= 601) {
if (window.innerWidth >= 650) {
setShowMenu(true)
}

window.addEventListener('resize', () => {
if (window.innerWidth >= 601) {
if (window.innerWidth >= 650) {
setShowMenu(true)
setForceShowMenu(false)
return
Expand All @@ -58,8 +58,11 @@ const NavBar = (props: { children: any }) => {
}
{
(!showMenu) ? (
<button className="menu-btn" onClick={() => setForceShowMenu(!forceShowMenu)}>
<StaticImage src={HBMenu} alt="menu" width={22} />
<button className="menu-btn"
onClick={() => setForceShowMenu(!forceShowMenu)}>
<div style={{ width: 22 }}>
<StaticImage src={HBMenu} alt="menu" width={22} />
</div>
</button>
): null
}
Expand Down

0 comments on commit 84294fc

Please sign in to comment.