-
Notifications
You must be signed in to change notification settings - Fork 155
Fix/fix nav on medium width devices #197
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
base: main
Are you sure you want to change the base?
Changes from all commits
e9dd57f
173bcdc
beb28fc
414acfa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,12 @@ | ||
| "use client"; | ||
| import React, { useState } from "react"; | ||
| import PrimaryButton from "../ui/custom-button"; | ||
| import { motion, useScroll, useMotionValueEvent } from "framer-motion"; | ||
| import Image from "next/image"; | ||
| import { Terminal, Github, Menu, X } from "lucide-react"; | ||
| import { Github, Menu, Terminal, X } from "lucide-react"; | ||
| import Link from "next/link"; | ||
| import { usePathname } from "next/navigation"; | ||
| import { cn } from "@/lib/utils"; | ||
| import PrimaryButton from "../ui/custom-button"; | ||
|
|
||
| const Navbar = () => { | ||
| const { scrollYProgress } = useScroll(); | ||
|
|
@@ -37,7 +37,7 @@ const Navbar = () => { | |
| { name: "Pricing", href: "/pricing" }, | ||
| { name: "Features", href: "/#features" }, | ||
| { name: "Demo", href: "/#demo" }, | ||
| { name: "How it works", href: "/#HIW" }, | ||
| { name: "working", href: "/#HIW" }, | ||
| { name: "Stats", href: "/#Stats" }, | ||
| { name: "Contact", href: "/#Contact" }, | ||
| { name: "FAQ", href: "/#faq" }, | ||
|
|
@@ -46,99 +46,109 @@ const Navbar = () => { | |
| return ( | ||
| <motion.nav | ||
| initial={{ opacity: 0 }} | ||
| animate={showNavbar ? { opacity: 1 } : { opacity: 0, display: 'none' }} | ||
| animate={showNavbar ? { opacity: 1 } : { opacity: 0, display: "none" }} | ||
| transition={{ duration: 0.3 }} | ||
| className={cn( | ||
| " z-40 flex items-center justify-between px-4 py-3 bg-neutral-900/5 backdrop-blur-xl border-white/10", | ||
| isPricingPage | ||
| ? "relative h-max md:w-full top-0 border-b" | ||
| : "fixed rounded-3xl top-4 border w-[94%] md:w-[80%] mx-auto left-1/2 -translate-x-1/2" | ||
| : "fixed rounded-3xl top-4 border w-[96%] md:w-[80%] mx-auto left-1/2 -translate-x-1/2" | ||
| )} | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| > | ||
| <div className="flex items-center gap-3"> | ||
| <button | ||
| className="md:hidden text-white" | ||
| onClick={() => setIsOpen(!isOpen)} | ||
| aria-label="Toggle navigation menu" | ||
| aria-expanded={isOpen} | ||
| > | ||
| {isOpen ? <X size={28} /> : <Menu size={28} />} | ||
| </button> | ||
| <div className="text-xl md:text-2xl font-medium tracking-tighter flex items-center gap-2"> | ||
| <div className="w-8 md:w-10 aspect-square overflow-hidden relative"> | ||
| <Image | ||
| src="/assets/logo.svg" | ||
| alt="background" | ||
| fill | ||
| className="object-cover w-full h-full" | ||
| /> | ||
| <div className="flex items-center gap-3 w-full justify-between"> | ||
| {/* opensox logo */} | ||
| <div className="flex items-center gap-1 lg:gap-3"> | ||
| <button | ||
| className="md:hidden text-white" | ||
| onClick={() => setIsOpen(!isOpen)} | ||
| aria-label="Toggle navigation menu" | ||
| aria-expanded={isOpen} | ||
| > | ||
| {isOpen ? <X size={28} /> : <Menu size={28} />} | ||
| </button> | ||
| <div className="text-base lg:text-2xl font-medium tracking-tighter flex items-center gap-2"> | ||
| <div className="w-8 md:w-10 aspect-square overflow-hidden relative"> | ||
| <Image | ||
| src="/assets/logo.svg" | ||
| alt="background" | ||
| fill | ||
| className="object-cover w-full h-full" | ||
| /> | ||
| </div> | ||
| <span className="text-nowrap">Opensox AI</span> | ||
|
Comment on lines
+70
to
+78
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. image alt text is not descriptive the logo image currently uses use a more meaningful alt, e.g. 🤖 Prompt for AI Agents |
||
| </div> | ||
| <span>Opensox AI</span> | ||
| </div> | ||
| </div> | ||
| <div className="hidden md:flex items-center gap-5 tracking-tight text-lg font-light text-text-tertiary"> | ||
| {links.map((link, index) => { | ||
| const isActive = pathname === link.href; | ||
| return ( | ||
| <Link | ||
| key={index} | ||
| href={link.href} | ||
| className={cn( | ||
| "cursor-pointer hover:text-white", | ||
| isActive && "text-white" | ||
| )} | ||
| > | ||
| {link.name} | ||
| </Link> | ||
| ); | ||
| })} | ||
| </div> | ||
| <div className="flex items-center gap-3"> | ||
| <Link | ||
| href="https://github.com/apsinghdev/opensox" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| className="hidden lg:flex items-center gap-2 px-4 py-2.5 bg-[#0d1117] hover:bg-[#161b22] transition-colors rounded-lg border border-[#30363d] text-white" | ||
| > | ||
| <Github className="w-5 h-5" /> | ||
| <span className="text-sm font-medium">Contribute</span> | ||
| </Link> | ||
| <Link href="/dashboard/home" className="cursor-pointer z-30"> | ||
| <PrimaryButton classname="px-3 py-2 text-sm whitespace-nowrap md:px-5 md:py-3 md:text-base"> | ||
| <Terminal className="w-4 h-4 md:w-5 md:h-5" /> | ||
| <span>Get Started</span> | ||
| </PrimaryButton> | ||
| </Link> | ||
| </div> | ||
| {isOpen && ( | ||
| <motion.div | ||
| initial={{ opacity: 0, y: -10 }} | ||
| animate={{ opacity: 1, y: 0 }} | ||
| transition={{ duration: 0.25 }} | ||
| className="absolute top-full mt-2 left-0 w-full bg-neutral-900/90 backdrop-blur-xl border border-white/10 md:hidden flex flex-col items-center py-5 space-y-4 z-50 rounded-3xl" | ||
| > | ||
| {links.map((link, index) => ( | ||
| <Link | ||
| key={index} | ||
| href={link.href} | ||
| onClick={() => setIsOpen(false)} | ||
| className="text-white hover:text-gray-300 text-lg" | ||
| > | ||
| {link.name} | ||
| </Link> | ||
| ))} | ||
| {/* links to be rendered */} | ||
| <div className="hidden md:flex items-center gap-5 tracking-tight text-sm lg:text-base xl:text-lg font-light text-text-tertiary"> | ||
| {links.map((link, index) => { | ||
| const isActive = pathname === link.href; | ||
| return ( | ||
| <Link | ||
| key={index} | ||
| href={link.href} | ||
| className={cn( | ||
| "cursor-pointer hover:text-white text-sm lg:text-base", | ||
| isActive && "text-white" | ||
| )} | ||
| > | ||
| {link.name} | ||
| </Link> | ||
| ); | ||
| })} | ||
| </div> | ||
|
|
||
| {/* git link */} | ||
| <div className="flex items-center gap-3"> | ||
| <Link | ||
| href="https://github.com/apsinghdev/opensox" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| onClick={() => setIsOpen(false)} | ||
| className="flex items-center gap-2 px-4 py-2 bg-[#0d1117] hover:bg-[#161b22] rounded-lg border border-[#30363d] text-white transition-colors" | ||
| className="hidden xl:flex items-center gap-2 px-4 py-2.5 bg-[#0d1117] hover:bg-[#161b22] transition-colors rounded-lg border border-[#30363d] text-white" | ||
| > | ||
| <Github className="w-5 h-5" /> | ||
| <span className="text-sm font-medium">Contribute</span> | ||
| </Link> | ||
| </motion.div> | ||
| )} | ||
| <Link | ||
| href="/dashboard/home" | ||
| className="flex md:hidden lg:flex cursor-pointer z-30" | ||
| > | ||
| <PrimaryButton classname=" px-3 py-2 text-sm whitespace-nowrap md:px-5 md:py-3 md:text-base"> | ||
| <Terminal className="w-4 h-4 md:w-5 md:h-5" /> | ||
| <span>Get Started</span> | ||
| </PrimaryButton> | ||
| </Link> | ||
| </div> | ||
| {/* mobile nav dropdown */} | ||
| {isOpen && ( | ||
| <motion.div | ||
| initial={{ opacity: 0, y: -10 }} | ||
| animate={{ opacity: 1, y: 0 }} | ||
| transition={{ duration: 0.25 }} | ||
| className="absolute top-full mt-2 left-0 w-full bg-neutral-900/90 backdrop-blur-xl border border-white/10 md:hidden flex flex-col items-center py-5 space-y-4 z-50 rounded-3xl" | ||
| > | ||
| {links.map((link, index) => ( | ||
| <Link | ||
| key={index} | ||
| href={link.href} | ||
| onClick={() => setIsOpen(false)} | ||
| className="text-white hover:text-gray-300 text-lg" | ||
| > | ||
| {link.name} | ||
| </Link> | ||
| ))} | ||
| <Link | ||
| href="https://github.com/apsinghdev/opensox" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| onClick={() => setIsOpen(false)} | ||
| className="flex items-center gap-2 px-4 py-2 bg-[#0d1117] hover:bg-[#161b22] rounded-lg border border-[#30363d] text-white transition-colors" | ||
| > | ||
| <Github className="w-5 h-5" /> | ||
| <span className="text-sm font-medium">Contribute</span> | ||
| </Link> | ||
| </motion.div> | ||
| )} | ||
| </div> | ||
| </motion.nav> | ||
| ); | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inconsistent navigation link label
the link label "working" is inconsistent with other properly capitalized navigation items and appears incomplete. based on the href
/#HIW(How It Works), this should likely be "How It Works" or "How it Works" to match the capitalization pattern of other links.apply this diff:
📝 Committable suggestion
🤖 Prompt for AI Agents