// LandingHero — cinematic above-the-fold for dev-tooling landings. // // Layout (desktop): // ┌───────────────────────────────────────────────────────────────┐ // │ • eyebrow │ // │ ▌ │ // │ Big gradient heading (2 lines) ┌────────────────────┐│ // │ │ CodeWindow (right) ││ // │ subtitle, body-size │ filename.tsx ││ // │ │ …syntax… ││ // │ [Primary CTA] [Secondary CTA] └────────────────────┘│ // │ │ // │ footnote │ // └───────────────────────────────────────────────────────────────┘ // // On mobile the code window moves below the text. The component // itself does not render the background — wrap it with MeshBackdrop + // GridOverlay in the parent so multiple sections can share the same // ambient layers. import type { ComponentType, ReactNode } from 'react' import { cn } from '../cn' import type { ShellLinkProps } from './docShell' interface CtaSpec { readonly label: string readonly href: string } interface LandingHeroProps { readonly eyebrow?: ReactNode /** Two-line heading: the second line gets the gradient + animation. */ readonly title: ReactNode /** Optional second line — when set, the layout renders title on * line 1 and this on line 2 with the gradient/animation. */ readonly titleAccent?: ReactNode readonly subtitle?: ReactNode readonly primaryCta?: CtaSpec readonly secondaryCta?: CtaSpec readonly footnote?: ReactNode /** Code window / illustration slot — sits on the right at md+, below * the CTAs on mobile. */ readonly aside?: ReactNode /** Anchor link for "scroll down" hint. */ readonly scrollAnchor?: string /** Visible caption on the scroll-down hint. Default `'Scroll'`. */ readonly scrollLabel?: ReactNode /** `aria-label` for the scroll-down hint. Default `'Scroll down'`. */ readonly scrollAriaLabel?: string readonly className?: string readonly LinkComponent?: ComponentType } // A schemed href (`https://…`, `mailto:` …) points off-origin, so open it in a // new tab with a safe rel; relative/hash hrefs stay same-tab. const isSchemed = (href: string): boolean => /^[a-z][a-z0-9+.-]*:\/\//i.test(href) const PlainLink = ({ to, className, children }: ShellLinkProps): ReactNode => isSchemed(to) ? {children} : {children} export const LandingHero = ({ eyebrow, title, titleAccent, subtitle, primaryCta, secondaryCta, footnote, aside, scrollAnchor, scrollLabel = 'Scroll', scrollAriaLabel = 'Scroll down', className, LinkComponent = PlainLink, }: LandingHeroProps): ReactNode => { const Link = LinkComponent return (
{/* ---- Left column: copy + CTAs ---- */}
{eyebrow ? (
{eyebrow}
) : null}

{title} {titleAccent ? ( <>
{titleAccent} ) : null}

{subtitle ? (

{subtitle}

) : null} {(primaryCta || secondaryCta) ? (
{primaryCta ? ( {primaryCta.label} ) : null} {secondaryCta ? ( {secondaryCta.label} ) : null}
) : null} {footnote ? (
{footnote}
) : null}
{/* ---- Right column: code/illustration ---- */} {aside ? (
{aside}
) : null}
{/* Scroll hint — anchored to the SECTION (not the content column), so it sits at the bottom of the full-height hero, at the fold. */} {scrollAnchor ? ( {scrollLabel} ) : null}
) }