From bbd93de4c65944119e535e0173317cd310dcb799 Mon Sep 17 00:00:00 2001 From: arsam Date: Fri, 18 Sep 2026 23:14:11 +0330 Subject: [PATCH] Import source: cshare-app/src/components/Navbar Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality. --- cshare-app/src/components/Navbar.jsx | 165 +++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 cshare-app/src/components/Navbar.jsx diff --git a/cshare-app/src/components/Navbar.jsx b/cshare-app/src/components/Navbar.jsx new file mode 100644 index 0000000..be71edb --- /dev/null +++ b/cshare-app/src/components/Navbar.jsx @@ -0,0 +1,165 @@ +import { useState, useEffect } from 'react'; +import { useNavigate, useLocation } from 'react-router-dom'; +import { MenuIcon, XIcon } from './Icons'; + +export default function Navbar() { + const navigate = useNavigate(); + const { pathname } = useLocation(); + const [mobileOpen, setMobileOpen] = useState(false); + const [scrolled, setScrolled] = useState(false); + + useEffect(() => { + const onScroll = () => setScrolled(window.scrollY > 20); + window.addEventListener('scroll', onScroll, { passive: true }); + return () => window.removeEventListener('scroll', onScroll); + }, []); + + const links = [ + { path: '/', label: 'Home' }, + { path: '/upload', label: 'Upload' }, + { path: '/dashboard', label: 'Dashboard' }, + { path: '/preview', label: 'Preview' }, + ]; + + const extraLinks = [ + { + label: 'Features', + action: () => { + navigate('/'); + setTimeout(() => document.getElementById('features')?.scrollIntoView({ behavior: 'smooth' }), 150); + }, + }, + { + label: 'How it Works', + action: () => { + navigate('/'); + setTimeout(() => document.getElementById('how-it-works')?.scrollIntoView({ behavior: 'smooth' }), 150); + }, + }, + { label: 'Pricing', action: () => go('/pricing') }, + { label: 'Docs', action: () => go('/docs') }, + ]; + + const go = (path) => { + navigate(path); + setMobileOpen(false); + window.scrollTo({ top: 0, behavior: 'smooth' }); + }; + + return ( + <> + + {mobileOpen && ( +
+
+ {links.map((link) => ( + + ))} + {extraLinks.map((link, i) => ( + + ))} + +
+
+ )} + + ); +}