-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e255134
commit f296482
Showing
9 changed files
with
345 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"cSpell.words": ["CODECRAFT", "tailwindcss"], | ||
"cSpell.words": ["CODECRAFT", "headlessui", "tailwindcss"], | ||
"prettier.configPath": "./prettier.config.js", | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
"source.fixAll.eslint": "explicit" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
app/(landing)/sections/Hero.tsx → app/(landing)/sections/Hero/Hero.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
'use client'; | ||
|
||
import React from "react"; | ||
import { MdOutlineMenu } from "react-icons/md"; | ||
import { Fragment } from "react"; | ||
// import { scrollToSectionName } from "./utilities"; | ||
import { usePathname, useRouter } from "next/navigation"; | ||
import { Menu, Transition } from "@headlessui/react"; | ||
import Image from "next/image"; | ||
import Link from "next/link"; | ||
|
||
function scrollToSectionName(sectionName: string) { | ||
const section = document.getElementById(sectionName); | ||
if (section) { | ||
section.scrollIntoView({ behavior: "smooth" }); | ||
} | ||
} | ||
|
||
function MenuItem(props: { sectionName: string }) { | ||
const { sectionName } = props; | ||
return ( | ||
<Menu.Item> | ||
{({ active }) => ( | ||
<button | ||
className={`${active ? "bg-f23-lightGreen text-white" : "text-gray-900"} | ||
group flex w-full items-center rounded-md px-2 py-2 text-lg`} | ||
onClick={() => scrollToSectionName(sectionName)} | ||
> | ||
{sectionName} | ||
</button> | ||
)} | ||
</Menu.Item> | ||
); | ||
} | ||
function OtherPageMenuItem(props: { sectionName: string }) { | ||
const { sectionName } = props; | ||
const history = useRouter(); | ||
return ( | ||
<Menu.Item> | ||
{({ active }) => ( | ||
|
||
<button | ||
className={`${active ? "bg-f23-lightGreen text-white" : "text-gray-900"} | ||
group flex w-full items-center rounded-md px-2 py-2 text-lg`} | ||
onClick={() => { | ||
history.push("/contact"); | ||
}} | ||
> | ||
{sectionName} | ||
</button> | ||
|
||
|
||
)} | ||
</Menu.Item> | ||
); | ||
} | ||
|
||
function CollapsedMenu() { | ||
return ( | ||
<div className="text-right bg-f23-mediumGreen rounded-md z-40 md:hidden absolute right-28 top-4 "> | ||
<Menu | ||
as="div" | ||
className="relative inline-block text-left" | ||
> | ||
<div> | ||
<Menu.Button className="inline-flex w-full justify-center rounded-md hover:bg-black hover:bg-opacity-20 px-2 py-2 text-sm font-medium text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75"> | ||
<MdOutlineMenu | ||
color="white" | ||
size={40} | ||
/> | ||
</Menu.Button> | ||
</div> | ||
<Transition | ||
as={Fragment} | ||
enter="transition ease-out duration-100" | ||
enterFrom="transform opacity-0 scale-95" | ||
enterTo="transform opacity-100 scale-100" | ||
leave="transition ease-in duration-75" | ||
leaveFrom="transform opacity-100 scale-100" | ||
leaveTo="transform opacity-0 scale-95" | ||
> | ||
<Menu.Items className="absolute right-0 mt-2 w-56 origin-top-right divide-y divide-gray-100 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none"> | ||
<div className="px-1 py-1"> | ||
<MenuItem sectionName="Home" /> | ||
<MenuItem sectionName="About" /> | ||
<MenuItem sectionName="Schedule" /> | ||
<MenuItem sectionName="FAQ" /> | ||
{/* <MenuItem sectionName="Sponsors" /> */} | ||
{<OtherPageMenuItem sectionName="Contact" />} | ||
</div> | ||
</Menu.Items> | ||
</Transition> | ||
</Menu> | ||
</div> | ||
); | ||
} | ||
|
||
/** | ||
* TODO: Make navbar sticky and then change the glow to the section that is currently present ?? | ||
*/ | ||
|
||
function Navbar() { | ||
const pathname = usePathname(); | ||
const isContactPage = pathname === "/contact"; | ||
const sections = ["Home", "About", "Schedule", "FAQ"]; | ||
|
||
return ( | ||
<div className="flex md:fixed justify-end z-40 w-full"> | ||
<Image | ||
width={0} | ||
height={0} | ||
sizes={"100vw"} | ||
src="/landing/yellow_hackru.png" | ||
alt="yellow hackru logo" | ||
className="w-24 absolute top-0 left-4 z-50" | ||
/> | ||
|
||
<a | ||
href="https://mlh.io/na?utm_source=na-hackathon&utm_medium=TrustBadge&utm_campaign=2024-season&utm_content=white" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
|
||
<Image | ||
width={0} | ||
height={0} | ||
className="w-24 absolute top-0 right-0 z-50" | ||
src="https://s3.amazonaws.com/logged-assets/trust-badge/2024/mlh-trust-badge-2024-yellow.svg" | ||
alt="Major League Hacking 2024 Hackathon Season" | ||
/> | ||
</a> | ||
|
||
<CollapsedMenu /> | ||
<div | ||
className="absolute top-0 font-light text-text hidden md:flex | ||
text-lg pt-8 pr-20 z-40 bg-gradient-to-b from-f23-lightGreen w-[100%] justify-end" | ||
> | ||
|
||
{!isContactPage && (<> | ||
{ | ||
sections.map((section) => { | ||
return ( | ||
<button | ||
className="glow-center font-medium uppercase mr-5" | ||
onClick={() => scrollToSectionName(section)} | ||
key={section} | ||
> | ||
{section} | ||
</button> | ||
); | ||
}) | ||
} | ||
<Link href="/contact"> | ||
<button className="glow-center font-medium uppercase mr-5"> | ||
Contact | ||
</button> | ||
</Link> | ||
</>) | ||
} | ||
|
||
{ | ||
isContactPage && ( | ||
<Link href="/"> | ||
<button className="glow-center font-medium uppercase mr-5"> | ||
Home | ||
</button> | ||
</Link> | ||
) | ||
} | ||
</div> | ||
|
||
</div> | ||
); | ||
} | ||
|
||
|
||
export default Navbar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.