refactor header to sticky with scroll-based background blur
This commit is contained in:
@@ -7,14 +7,16 @@ import { HomePrinciples } from '@/components/HomePrinciples'
|
|||||||
import { HomeMilestones } from '@/components/HomeMilestones'
|
import { HomeMilestones } from '@/components/HomeMilestones'
|
||||||
import { HomeVentures } from '@/components/HomeVentures'
|
import { HomeVentures } from '@/components/HomeVentures'
|
||||||
import { Quote } from '@/components/Quote'
|
import { Quote } from '@/components/Quote'
|
||||||
import { Header_darkbg } from '@/components/Header_darkbg'
|
import { HomeStickyHeader } from '@/components/HomeStickyHeader'
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Header_darkbg />
|
|
||||||
<main>
|
<main>
|
||||||
<Hero />
|
<HomeStickyHeader />
|
||||||
|
<section className="relative min-h-screen">
|
||||||
|
<Hero className="-mt-20" />
|
||||||
|
</section>
|
||||||
<HomeAbout />
|
<HomeAbout />
|
||||||
<HomePrinciples />
|
<HomePrinciples />
|
||||||
<HomeMilestones />
|
<HomeMilestones />
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ function MobileNavigation() {
|
|||||||
|
|
||||||
export function Header() {
|
export function Header() {
|
||||||
return (
|
return (
|
||||||
<header className="py-5">
|
<header className="py-5 bg-transparent">
|
||||||
<Container>
|
<Container>
|
||||||
<nav className="relative z-50 flex justify-between">
|
<nav className="relative z-50 flex justify-between">
|
||||||
|
|
||||||
@@ -92,9 +92,9 @@ export function Header() {
|
|||||||
<Logo className="h-6 w-auto lg:h-6 md:h-8" />
|
<Logo className="h-6 w-auto lg:h-6 md:h-8" />
|
||||||
</Link>
|
</Link>
|
||||||
<div className="hidden md:flex md:gap-x-6">
|
<div className="hidden md:flex md:gap-x-6">
|
||||||
<NavLink href="/about">About</NavLink>
|
<NavLink className="text-white" href="/about">ABOUT</NavLink>
|
||||||
<NavLink href="/ventures">Ventures</NavLink>
|
<NavLink className="text-white" href="/ventures">VENTURES</NavLink>
|
||||||
<NavLink href="/people">People</NavLink>
|
<NavLink className="text-white" href="/people">PEOPLE</NavLink>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-x-5 md:gap-x-8">
|
<div className="flex items-center gap-x-5 md:gap-x-8">
|
||||||
|
|||||||
@@ -98,14 +98,7 @@ function MobileNavigation() {
|
|||||||
|
|
||||||
export function Header_darkbg() {
|
export function Header_darkbg() {
|
||||||
return (
|
return (
|
||||||
<header className="py-5 relative">
|
<header className="py-5 bg-transparent relative">
|
||||||
<div
|
|
||||||
className="absolute inset-0 pointer-events-none"
|
|
||||||
style={{
|
|
||||||
background: '#000000',
|
|
||||||
opacity: 1
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Container>
|
<Container>
|
||||||
<nav className="relative z-50 flex justify-between">
|
<nav className="relative z-50 flex justify-between">
|
||||||
<div className="flex items-center md:gap-x-12">
|
<div className="flex items-center md:gap-x-12">
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
|
import clsx from 'clsx'
|
||||||
|
|
||||||
import { Button } from '@/components/Button'
|
import { Button } from '@/components/Button'
|
||||||
import { Container } from '@/components/Container'
|
import { Container } from '@/components/Container'
|
||||||
import { Logo_hero } from '@/components/Logo_hero'
|
import { Logo_hero } from '@/components/Logo_hero'
|
||||||
|
|
||||||
|
|
||||||
|
type HeroProps = {
|
||||||
|
className?: string
|
||||||
|
}
|
||||||
|
|
||||||
export function Hero() {
|
export function Hero({ className }: HeroProps) {
|
||||||
return (
|
return (
|
||||||
<div className="relative overflow-hidden min-h-screen">
|
<div className={clsx('relative overflow-hidden min-h-screen', className)}>
|
||||||
{/* Video Background */}
|
{/* Video Background */}
|
||||||
<video
|
<video
|
||||||
autoPlay
|
autoPlay
|
||||||
|
|||||||
32
src/components/HomeStickyHeader.tsx
Normal file
32
src/components/HomeStickyHeader.tsx
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import { useEffect, useState } from "react"
|
||||||
|
import clsx from "clsx"
|
||||||
|
|
||||||
|
import { Header_darkbg } from "@/components/Header_darkbg"
|
||||||
|
|
||||||
|
export function HomeStickyHeader() {
|
||||||
|
const [scrolled, setScrolled] = useState(false)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleScroll = () => {
|
||||||
|
setScrolled(window.scrollY > 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
handleScroll()
|
||||||
|
window.addEventListener("scroll", handleScroll)
|
||||||
|
|
||||||
|
return () => window.removeEventListener("scroll", handleScroll)
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={clsx(
|
||||||
|
"sticky top-0 z-30 transition-all duration-300",
|
||||||
|
scrolled && "bg-black/40 backdrop-blur-md",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<Header_darkbg />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user