diff --git a/src/Header/Component.client.tsx b/src/Header/Component.client.tsx index a4bd658..6a3403d 100644 --- a/src/Header/Component.client.tsx +++ b/src/Header/Component.client.tsx @@ -8,13 +8,31 @@ import type { Header } from '@/payload-types' import { Logo } from '@/components/Logo/Logo' import { HeaderNav } from './Nav' +import { useThemeMode } from '@/hooks/useThemeMode' interface HeaderClientProps { data: Header } +function ToggleButton() { + const { isDark, toggle } = useThemeMode() + return ( + + {isDark ? '☀ Light' : '☾ Dark'} + + ) +} + export const HeaderClient: React.FC = ({ data }) => { - /* Storing the value in a useState to avoid hydration errors */ const [theme, setTheme] = useState(null) const { headerTheme, setHeaderTheme } = useHeaderTheme() const pathname = usePathname() @@ -30,12 +48,15 @@ export const HeaderClient: React.FC = ({ data }) => { }, [headerTheme]) return ( - + - + + + + ) diff --git a/src/components/HeroPage.tsx b/src/components/HeroPage.tsx index d56a213..0e8bbf2 100644 --- a/src/components/HeroPage.tsx +++ b/src/components/HeroPage.tsx @@ -2,12 +2,15 @@ import React, { useEffect, useRef, useState } from 'react' import { cn } from '@/utilities/ui' -import { Button, buttonVariants } from '@/components/ui/button' import { ArrowRightIcon, PhoneCallIcon } from 'lucide-react' import { createPortal } from 'react-dom' import { MenuToggleIcon } from '@/components/ui/menu-toggle-icon' import { useScroll } from '@/components/ui/use-scroll' import { useThemeMode } from '@/hooks/useThemeMode' +import { CMSLink } from '@/components/Link' +import RichText from '@/components/RichText' +import type { Page } from '@/payload-types' +import { Button } from '@/components/ui/button' // ─── Types ──────────────────────────────────────────────────────────────────── @@ -162,123 +165,15 @@ function Background({ isDark }: { isDark: boolean }) { return } -// ─── Header ─────────────────────────────────────────────────────────────────── - -function Header({ isDark, onToggle }: { isDark: boolean; onToggle: () => void }) { - const [open, setOpen] = useState(false) - const scrolled = useScroll(10) - - const links = [ - { label: 'Work', href: '#work' }, - { label: 'About', href: '#about' }, - { label: 'Contact', href: '#contact' }, - ] - - useEffect(() => { - document.body.style.overflow = open ? 'hidden' : '' - return () => { document.body.style.overflow = '' } - }, [open]) - - const textColor = isDark ? 'text-white/80 hover:text-white' : 'text-black/70 hover:text-black' - const borderColor = isDark ? 'border-white/10' : 'border-black/10' - - return ( - - - {/* Wordmark */} - - - - - {/* Desktop links */} - - {links.map(l => ( - {l.label} - ))} - - {/* Light / dark toggle */} - - {isDark ? '☀ Light' : '☾ Dark'} - - - - Hire me - - - - {/* Mobile toggle */} - setOpen(!open)} - className={cn('md:hidden', isDark ? 'border-white/20 text-white bg-transparent' : '')} - aria-expanded={open} - > - - - - - {/* Mobile menu */} - {open && typeof window !== 'undefined' && createPortal( - - - {links.map(l => ( - setOpen(false)} - className={cn('px-3 py-2 rounded-md text-sm font-medium', textColor)} - >{l.label} - ))} - - - { onToggle(); setOpen(false) }} - className={cn('w-full rounded-full border py-2 text-sm', isDark ? 'border-white/20 text-white' : 'border-black/20 text-black')} - >{isDark ? '☀ Light mode' : '☾ Dark mode'} - Hire me - - , - document.body - )} - - ) -} - // ─── Hero section ───────────────────────────────────────────────────────────── -function HeroSection({ isDark, heading, subheading, badgeText }: { - isDark: boolean - heading: string - subheading: string - badgeText: string -}) { - const text = isDark ? 'text-white' : 'text-black' - const muted = isDark ? 'text-white/55' : 'text-black/55' - const badge = isDark ? 'bg-white/8 border-white/15 text-white/70' : 'bg-black/5 border-black/12 text-black/60' +type HeroProps = Pick + +function HeroSection({ isDark, richText, links }: HeroProps & { isDark: boolean }) { + const muted = isDark ? 'text-white/55' : 'text-black/55' const borderLine = isDark ? 'bg-white/10' : 'bg-black/10' const borderLineFaint = isDark ? 'bg-white/5' : 'bg-black/5' + const richTextColor = isDark ? 'text-white' : 'text-black' return ( @@ -298,72 +193,47 @@ function HeroSection({ isDark, heading, subheading, badgeText }: { - {/* Badge */} - - {badgeText} - - - - - {/* Headline */} - - {heading} - - - {/* Subline */} - - {subheading} - - - {/* CTAs */} - - - - Book a call - - - View my work - - - + data={richText} + enableGutter={false} + /> + )} + + {/* Links from Payload */} + {Array.isArray(links) && links.length > 0 && ( + + {links.map(({ link }, i) => ( + + ))} + + )} ) } -// ─── Logo cloud (skills that i have) ───────────────────────────────────────── +// ─── Logo cloud ─────────────────────────────────────────────────────────────── const LOGOS = [ { src: 'https://storage.efferd.com/logo/nvidia-wordmark.svg', alt: 'Nvidia' }, @@ -375,15 +245,14 @@ const LOGOS = [ ] function LogosSection({ isDark }: { isDark: boolean }) { - const text = isDark ? 'text-white/40' : 'text-black/40' - const bold = isDark ? 'text-white/70' : 'text-black/70' + const text = isDark ? 'text-white/40' : 'text-black/40' const border = isDark ? 'border-white/10' : 'border-black/10' const logoFilter = isDark ? 'brightness-0 invert opacity-30' : 'brightness-0 opacity-25' return ( - Skills that i have + Skills {LOGOS.map(l => ( @@ -396,14 +265,12 @@ function LogosSection({ isDark }: { isDark: boolean }) { // ─── Main export ────────────────────────────────────────────────────────────── -// REPLACE WITH: interface HeroPageProps { - heading: string - subheading: string - badgeText: string + richText?: Page['hero']['richText'] + links?: Page['hero']['links'] } -export default function HeroPage({ heading, subheading, badgeText }: HeroPageProps) { +export default function HeroPage({ richText, links }: HeroPageProps) { const { isDark, toggle } = useThemeMode() return ( @@ -416,9 +283,8 @@ export default function HeroPage({ heading, subheading, badgeText }: HeroPagePro {/* Page content */} - - +
- {subheading} -
- Skills that i have + Skills