Fix navbar links not scrolling to sections
react-router-dom's Link intercepts hash-only navigation for client-side routing and never triggers the browser's native scroll-to-anchor behavior. Also half the nav items (Use Cases, Docs, Security) pointed at section ids that were never built. Switched hash links to plain anchor tags (real same-page scrolling), added a real #contact target in the footer, and trimmed the nav/footer to only link sections that actually exist. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
5b4834e6a5
commit
0444ef09aa
@ -2,6 +2,13 @@ import { Link } from 'react-router-dom';
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Menu, X } from 'lucide-react';
|
import { Menu, X } from 'lucide-react';
|
||||||
|
|
||||||
|
const SECTIONS = [
|
||||||
|
{ label: 'Features', hash: 'features' },
|
||||||
|
{ label: 'How It Works', hash: 'how-it-works' },
|
||||||
|
{ label: 'Pricing', hash: 'pricing' },
|
||||||
|
{ label: 'Contact', hash: 'contact' },
|
||||||
|
];
|
||||||
|
|
||||||
export default function Navbar() {
|
export default function Navbar() {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
return (
|
return (
|
||||||
@ -18,9 +25,9 @@ export default function Navbar() {
|
|||||||
|
|
||||||
{/* Desktop nav */}
|
{/* Desktop nav */}
|
||||||
<div className="hidden md:flex items-center gap-6 text-sm text-gray-600">
|
<div className="hidden md:flex items-center gap-6 text-sm text-gray-600">
|
||||||
{['Features', 'Use Cases', 'Pricing', 'Docs', 'Security', 'Contact'].map((item) => (
|
{SECTIONS.map(({ label, hash }) => (
|
||||||
<Link key={item} to={`#${item.toLowerCase().replace(' ', '-')}`}
|
<a key={hash} href={`#${hash}`}
|
||||||
className="hover:text-gray-900 transition-colors">{item}</Link>
|
className="hover:text-gray-900 transition-colors">{label}</a>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -42,9 +49,9 @@ export default function Navbar() {
|
|||||||
</div>
|
</div>
|
||||||
{open && (
|
{open && (
|
||||||
<div className="md:hidden border-t border-gray-100 bg-white px-4 py-4 space-y-3">
|
<div className="md:hidden border-t border-gray-100 bg-white px-4 py-4 space-y-3">
|
||||||
{['Features', 'Use Cases', 'Pricing', 'Docs', 'Security', 'Contact'].map((item) => (
|
{SECTIONS.map(({ label, hash }) => (
|
||||||
<Link key={item} to={`#${item.toLowerCase()}`}
|
<a key={hash} href={`#${hash}`}
|
||||||
className="block text-sm text-gray-700 py-1" onClick={() => setOpen(false)}>{item}</Link>
|
className="block text-sm text-gray-700 py-1" onClick={() => setOpen(false)}>{label}</a>
|
||||||
))}
|
))}
|
||||||
<hr className="border-gray-100" />
|
<hr className="border-gray-100" />
|
||||||
<Link to="/login" className="block text-sm text-gray-700 py-1">Log in</Link>
|
<Link to="/login" className="block text-sm text-gray-700 py-1">Log in</Link>
|
||||||
|
|||||||
@ -2,6 +2,12 @@
|
|||||||
@tailwind components;
|
@tailwind components;
|
||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
|
|
||||||
|
html {
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
/* offset for the fixed navbar (h-16 = 4rem) so anchor targets aren't hidden underneath it */
|
||||||
|
scroll-padding-top: 4rem;
|
||||||
|
}
|
||||||
|
|
||||||
@layer base {
|
@layer base {
|
||||||
body {
|
body {
|
||||||
@apply bg-white text-gray-900 antialiased;
|
@apply bg-white text-gray-900 antialiased;
|
||||||
|
|||||||
@ -33,7 +33,7 @@ export default function Landing() {
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
{/* Footer */}
|
{/* Footer */}
|
||||||
<footer className="bg-gray-900 text-gray-400 py-12">
|
<footer id="contact" className="bg-gray-900 text-gray-400 py-12">
|
||||||
<div className="max-w-7xl mx-auto px-4 flex flex-col sm:flex-row justify-between gap-6 text-xs">
|
<div className="max-w-7xl mx-auto px-4 flex flex-col sm:flex-row justify-between gap-6 text-xs">
|
||||||
<div>
|
<div>
|
||||||
<div className="flex items-center gap-2 mb-2">
|
<div className="flex items-center gap-2 mb-2">
|
||||||
@ -41,19 +41,21 @@ export default function Landing() {
|
|||||||
<span className="text-white font-semibold text-sm">OdooMCP Cloud</span>
|
<span className="text-white font-semibold text-sm">OdooMCP Cloud</span>
|
||||||
</div>
|
</div>
|
||||||
<p>Secure MCP Server for Odoo ERP</p>
|
<p>Secure MCP Server for Odoo ERP</p>
|
||||||
|
<p className="mt-3">
|
||||||
|
<a href="mailto:hello@odoomcp.cloud" className="hover:text-white transition-colors">
|
||||||
|
hello@odoomcp.cloud
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gap-12">
|
<div className="flex gap-12">
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<p className="text-white font-medium">Product</p>
|
<p className="text-white font-medium">Product</p>
|
||||||
{['Features', 'Pricing', 'Security', 'Docs'].map((l) => (
|
<p><a href="#features" className="hover:text-white transition-colors">Features</a></p>
|
||||||
<p key={l}><a href="#" className="hover:text-white transition-colors">{l}</a></p>
|
<p><a href="#pricing" className="hover:text-white transition-colors">Pricing</a></p>
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<p className="text-white font-medium">Company</p>
|
<p className="text-white font-medium">Company</p>
|
||||||
{['About', 'Blog', 'Contact', 'Privacy'].map((l) => (
|
<p><a href="#contact" className="hover:text-white transition-colors">Contact</a></p>
|
||||||
<p key={l}><a href="#" className="hover:text-white transition-colors">{l}</a></p>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user