id
This commit is contained in:
@@ -20,19 +20,19 @@ export default function Home() {
|
||||
<section id="home-hero">
|
||||
<HomeHero />
|
||||
</section>
|
||||
<section id="">
|
||||
<section id="about">
|
||||
<StackSectionPreview />
|
||||
</section>
|
||||
<section id="world-map">
|
||||
<section id="network">
|
||||
<WorldMap />
|
||||
</section>
|
||||
<section id="steps">
|
||||
<section id="deploy">
|
||||
<Steps />
|
||||
</section>
|
||||
<section id="companies">
|
||||
<section id="llms">
|
||||
<Companies />
|
||||
</section>
|
||||
<section id="use-cases">
|
||||
<section id="features">
|
||||
<UseCases />
|
||||
</section>
|
||||
<section id="get-started">
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import { type Metadata } from 'next'
|
||||
import { Mulish } from 'next/font/google'
|
||||
import clsx from 'clsx'
|
||||
import SmoothScrollProvider from '@/components/SmoothScrollProvider'
|
||||
|
||||
import '@/styles/tailwind.css'
|
||||
|
||||
@@ -26,7 +27,7 @@ export default function RootLayout({
|
||||
}) {
|
||||
return (
|
||||
<html lang="en" className={clsx('antialiased', mulish.variable)}>
|
||||
<body className="bg-black text-white">{children}</body>
|
||||
<body className="bg-black text-white"><SmoothScrollProvider>{children}</SmoothScrollProvider></body>
|
||||
</html>
|
||||
)
|
||||
}
|
||||
|
@@ -9,11 +9,11 @@ export function NavLinks() {
|
||||
let timeoutRef = useRef<number | null>(null)
|
||||
|
||||
return [
|
||||
['About', '/#stack-section'],
|
||||
['Network', '/#world-map'],
|
||||
['Deploy', '/#steps'],
|
||||
['LLMs', '/#companies'],
|
||||
['Features', '/#use-cases'],
|
||||
['About', '/#about'],
|
||||
['Network', '/#network'],
|
||||
['Deploy', '/#deploy'],
|
||||
['LLMs', '/#llms'],
|
||||
['Features', '/#features'],
|
||||
['Get Started', '/#get-started'],
|
||||
].map(([label, href], index) => (
|
||||
<Link
|
||||
|
8
src/components/SmoothScrollProvider.tsx
Normal file
8
src/components/SmoothScrollProvider.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
'use client'
|
||||
|
||||
import { useSmoothScroll } from '@/hooks/use-smooth-scroll';
|
||||
|
||||
export default function SmoothScrollProvider({ children }: { children: React.ReactNode }) {
|
||||
useSmoothScroll();
|
||||
return <>{children}</>;
|
||||
}
|
28
src/hooks/use-smooth-scroll.ts
Normal file
28
src/hooks/use-smooth-scroll.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export const useSmoothScroll = () => {
|
||||
useEffect(() => {
|
||||
const handleLinkClick = (e: MouseEvent) => {
|
||||
const target = e.target as HTMLAnchorElement;
|
||||
const href = target.getAttribute('href');
|
||||
|
||||
if (href && href.startsWith('#')) {
|
||||
e.preventDefault();
|
||||
const targetId = href.substring(1);
|
||||
const targetElement = document.getElementById(targetId);
|
||||
|
||||
if (targetElement) {
|
||||
targetElement.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('click', handleLinkClick);
|
||||
|
||||
return () => {
|
||||
document.removeEventListener('click', handleLinkClick);
|
||||
};
|
||||
}, []);
|
||||
};
|
Reference in New Issue
Block a user