Frosted Glass Photo Hero
Full-bleed lifestyle photo with a left-hand blurred (37px) frosted edge-fade mask and a top dark scrim. Light display headline sits on the left with a lime pill eyebrow, a subhead and a translucent pill CTA. Transparent header floats on top.
Rebuilt from seed.com in the Verdant Lab Editorial style.
Looks exactly like seed.com: brings its fonts and colours, namespaced so your own theme stays untouched.
Restyled to your project: uses your shadcn colours, fonts and radius, so it matches the rest of your app. Layout, type sizes and motion stay as designed.
Usage
Props: eyebrow, headline, subhead, ctaLabel, imageSrc, brand, navItems, signIn. The header gains a 19px backdrop blur after scrolling; the left edge of the photo is frosted via a masked 37px blur layer.
components/glass-promo-hero.tsx
"use client"; import { useLayoutEffect, useRef, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useEffect, useState } from "react"; type Props = { eyebrow?: string; headline?: string; subhead?: string; ctaLabel?: string; imageSrc?: string; brand?: string; navItems?: string[]; signIn?: string; }; export default function FrostedGlassPhotoHero({ eyebrow = "Spring Offer · 20% Off Everything", headline = "Build a calmer morning with 20% off + a free gift.", subhead = "Create a daily ritual that fits any kitchen, any schedule. Add a free travel tin to your first order.", ctaLabel = "Shop Starter Set", imageSrc = "https://yoink-app.fly.dev/stock/interior-2.jpg", brand = "Fernlight", navItems = ["Shop", "Science", "Learn"], signIn = "Sign in", }: Props) { const [scrolled, setScrolled] = useState(false); useEffect(() => { const on = () => setScrolled(window.scrollY > 10); on(); window.addEventListener("scroll", on, { passive: true }); return () => window.removeEventListener("scroll", on); }, []); return ( <section className="relative isolate min-h-[640px] h-[844px] max-h-screen w-full overflow-hidden bg-ink font-sans text-canvas"> <img src={imageSrc} alt="Warm sunlit wooden table with plants and linen" width={1600} height={1067} className="absolute inset-0 -z-30 h-full w-full object-cover" /> <div aria-hidden className="absolute inset-0 -z-20 backdrop-blur-[37px] bg-black/10" style={{ WebkitMaskImage: "linear-gradient(to right, #000 18.5%, transparent 49.2%)", maskImage: "linear-gradient(to right, #000 18.5%, transparent 49.2%)", }} /> <div aria-hidden className="absolute inset-0 -z-10 bg-[linear-gradient(rgba(0,0,0,0.2)_7.6%,rgba(0,0,0,0)_21.5%),linear-gradient(100deg,rgba(0,0,0,0.35),rgba(0,0,0,0)_60%)]" /> <header className={`fixed inset-x-0 top-0 z-20 flex items-center justify-between px-6 py-5 transition-all duration-300 ease-in-out md:px-12 ${ scrolled ? "backdrop-blur-[19px] bg-frost-glass" : "backdrop-blur-none" }`} > <nav className="flex items-center gap-6 md:gap-10" aria-label="Primary"> <a href="#" className="flex items-center gap-1.5 text-xl tracking-tight focus-visible:outline focus-visible:outline-2 focus-visible:outline-lime-highlight"> {brand} <span className="h-3 w-3 rounded-full bg-canvas" /> </a> <ul className="hidden gap-8 text-label sm:flex"> {navItems.map((n) => ( <li key={n}> <a href="#" className="opacity-90 hover:opacity-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-lime-highlight">{n}</a> </li> ))} </ul> </nav> <a href="#" className="text-label focus-visible:outline focus-visible:outline-2 focus-visible:outline-lime-highlight">{signIn}</a> </header> <div className="relative z-10 flex h-full items-center px-6 md:px-14"> <Reveal from="up" className="max-w-[560px]"> <span className="inline-block rounded-pill bg-lime-highlight px-2 py-1 text-caption text-ink"> {eyebrow} </span> <h1 className="mt-5 text-[40px] font-light leading-[1.1] tracking-[-0.02em] text-canvas/80 md:text-[52px]"> {headline} </h1> <p className="mt-5 max-w-[420px] text-body text-canvas/70">{subhead}</p> <a href="#" className="mt-8 inline-flex items-center rounded-pill bg-frost-glass px-6 py-3.5 text-lead text-ink backdrop-blur-md transition-all duration-[250ms] ease-out hover:bg-canvas focus-visible:outline focus-visible:outline-2 focus-visible:outline-lime-highlight" > {ctaLabel} </a> </Reveal> </div> </section> ); } // ---- Yoink motion (inlined, no dependencies): Reveal ---- const YK_EASE = "cubic-bezier(0.16, 1, 0.3, 1)"; const useYkLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect; function ykReducedMotion(): boolean { return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches; } // "idle": untouched (visible) · "hidden": waiting below the fold · "shown": play the entrance. // Content is only hidden once we know we can show it again (IntersectionObserver exists, motion allowed, // and there is a box to watch), and a safety net reveals anything on screen that is still hidden. type YkRevealState = "idle" | "hidden" | "shown"; function useYkReveal(ref: RefObject<Element | null>, once = true): YkRevealState { const [state, setState] = useState<YkRevealState>("idle"); useYkLayoutEffect(() => { const el = ref.current; if (!el || ykReducedMotion() || typeof IntersectionObserver === "undefined") return; // watch the element's own box, or its children when it has none (display: contents) const boxes = () => (getComputedStyle(el).display === "contents" ? Array.from(el.children) : [el]); const onScreen = (t: Element) => { const r = t.getBoundingClientRect(); return (r.width > 0 || r.height > 0) && r.bottom > 0 && r.right > 0 && r.top < window.innerHeight && r.left < window.innerWidth; }; if (!boxes().some((t) => t.getBoundingClientRect().width > 0 || t.getBoundingClientRect().height > 0)) return; // e.g. hidden at mount: leave it visible let shown = false; const show = (v: boolean) => { if (v !== shown) (shown = v), setState(v ? "shown" : "hidden"); }; setState("hidden"); const inView = new Set<Element>(); const io = new IntersectionObserver((entries) => { for (const e of entries) { if (e.isIntersecting) inView.add(e.target); else inView.delete(e.target); } if (inView.size) { show(true); if (once) io.disconnect(); } else if (!once) show(false); }); const watched = new Set<Element>(); const watch = () => boxes().forEach((t) => !watched.has(t) && (watched.add(t), io.observe(t))); watch(); // safety net: styles that land after mount (display: contents) get watched too, and nothing // stays hidden for more than a moment while it is actually on screen const start = Date.now(); const net = setInterval(() => { if (shown) return once && clearInterval(net); watch(); if (Date.now() - start > 2400 && boxes().some(onScreen)) show(true); }, 600); return () => { io.disconnect(); clearInterval(net); }; }, [once]); return state; } type YkRevealFrom = "up" | "down" | "left" | "right" | "scale" | "blur" | "none"; /** Fades content in as it scrolls into view. */ function Reveal({ children, from = "up", delay = 0, duration = 700, distance = 24, once = true, as = "div", className, style, }: { children?: ReactNode; from?: YkRevealFrom; delay?: number; duration?: number; distance?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); const hidden = state === "hidden"; const offset = { up: `translate3d(0, ${distance}px, 0)`, down: `translate3d(0, ${-distance}px, 0)`, left: `translate3d(${-distance}px, 0, 0)`, right: `translate3d(${distance}px, 0, 0)`, scale: "scale(0.94)", blur: `translate3d(0, ${distance / 2}px, 0)`, none: "none", }[from]; const t = `${duration}ms ${YK_EASE} ${delay}ms`; return ( <Tag ref={ref} className={className} style={{ ...style, ...(hidden && { opacity: 0, transform: offset, filter: from === "blur" ? "blur(12px)" : undefined }), ...(state === "shown" && { transition: `opacity ${t}, transform ${t}, filter ${t}` }), }} > {children} </Tag> ); }"use client"; import { useLayoutEffect, useRef, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useEffect, useState } from "react"; type Props = { eyebrow?: string; headline?: string; subhead?: string; ctaLabel?: string; imageSrc?: string; brand?: string; navItems?: string[]; signIn?: string; }; export default function FrostedGlassPhotoHero({ eyebrow = "Spring Offer · 20% Off Everything", headline = "Build a calmer morning with 20% off + a free gift.", subhead = "Create a daily ritual that fits any kitchen, any schedule. Add a free travel tin to your first order.", ctaLabel = "Shop Starter Set", imageSrc = "https://yoink-app.fly.dev/stock/interior-2.jpg", brand = "Fernlight", navItems = ["Shop", "Science", "Learn"], signIn = "Sign in", }: Props) { const [scrolled, setScrolled] = useState(false); useEffect(() => { const on = () => setScrolled(window.scrollY > 10); on(); window.addEventListener("scroll", on, { passive: true }); return () => window.removeEventListener("scroll", on); }, []); return ( <section className="relative isolate min-h-[640px] h-[844px] max-h-screen w-full overflow-hidden bg-foreground font-sans text-background"> <img src={imageSrc} alt="Warm sunlit wooden table with plants and linen" width={1600} height={1067} className="absolute inset-0 -z-30 h-full w-full object-cover" /> <div aria-hidden className="absolute inset-0 -z-20 backdrop-blur-[37px] bg-foreground/10" style={{ WebkitMaskImage: "linear-gradient(to right, #000 18.5%, transparent 49.2%)", maskImage: "linear-gradient(to right, #000 18.5%, transparent 49.2%)", }} /> <div aria-hidden className="absolute inset-0 -z-10 bg-[linear-gradient(rgba(0,0,0,0.2)_7.6%,rgba(0,0,0,0)_21.5%),linear-gradient(100deg,rgba(0,0,0,0.35),rgba(0,0,0,0)_60%)]" /> <header className={`fixed inset-x-0 top-0 z-20 flex items-center justify-between px-6 py-5 transition-all duration-300 ease-in-out md:px-12 ${ scrolled ? "backdrop-blur-[19px] bg-foreground" : "backdrop-blur-none" }`} > <nav className="flex items-center gap-6 md:gap-10" aria-label="Primary"> <a href="#" className="flex items-center gap-1.5 text-xl tracking-tight focus-visible:outline focus-visible:outline-2 focus-visible:outline-verdant-lime-highlight"> {brand} <span className="h-3 w-3 rounded-full bg-background" /> </a> <ul className="hidden gap-8 text-verdant-label sm:flex"> {navItems.map((n) => ( <li key={n}> <a href="#" className="opacity-90 hover:opacity-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-verdant-lime-highlight">{n}</a> </li> ))} </ul> </nav> <a href="#" className="text-verdant-label focus-visible:outline focus-visible:outline-2 focus-visible:outline-verdant-lime-highlight">{signIn}</a> </header> <div className="relative z-10 flex h-full items-center px-6 md:px-14"> <Reveal from="up" className="max-w-[560px]"> <span className="inline-block rounded-full bg-verdant-lime-highlight px-2 py-1 text-verdant-caption text-foreground"> {eyebrow} </span> <h1 className="mt-5 text-[40px] font-light leading-[1.1] tracking-[-0.02em] text-background/80 md:text-[52px]"> {headline} </h1> <p className="mt-5 max-w-[420px] text-verdant-body text-background/70">{subhead}</p> <a href="#" className="mt-8 inline-flex items-center rounded-full bg-primary px-6 py-3.5 text-verdant-lead text-primary-foreground backdrop-blur-md transition-all duration-[250ms] ease-out hover:bg-background focus-visible:outline focus-visible:outline-2 focus-visible:outline-verdant-lime-highlight" > {ctaLabel} </a> </Reveal> </div> </section> ); } // ---- Yoink motion (inlined, no dependencies): Reveal ---- const YK_EASE = "cubic-bezier(0.16, 1, 0.3, 1)"; const useYkLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect; function ykReducedMotion(): boolean { return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches; } // "idle": untouched (visible) · "hidden": waiting below the fold · "shown": play the entrance. // Content is only hidden once we know we can show it again (IntersectionObserver exists, motion allowed, // and there is a box to watch), and a safety net reveals anything on screen that is still hidden. type YkRevealState = "idle" | "hidden" | "shown"; function useYkReveal(ref: RefObject<Element | null>, once = true): YkRevealState { const [state, setState] = useState<YkRevealState>("idle"); useYkLayoutEffect(() => { const el = ref.current; if (!el || ykReducedMotion() || typeof IntersectionObserver === "undefined") return; // watch the element's own box, or its children when it has none (display: contents) const boxes = () => (getComputedStyle(el).display === "contents" ? Array.from(el.children) : [el]); const onScreen = (t: Element) => { const r = t.getBoundingClientRect(); return (r.width > 0 || r.height > 0) && r.bottom > 0 && r.right > 0 && r.top < window.innerHeight && r.left < window.innerWidth; }; if (!boxes().some((t) => t.getBoundingClientRect().width > 0 || t.getBoundingClientRect().height > 0)) return; // e.g. hidden at mount: leave it visible let shown = false; const show = (v: boolean) => { if (v !== shown) (shown = v), setState(v ? "shown" : "hidden"); }; setState("hidden"); const inView = new Set<Element>(); const io = new IntersectionObserver((entries) => { for (const e of entries) { if (e.isIntersecting) inView.add(e.target); else inView.delete(e.target); } if (inView.size) { show(true); if (once) io.disconnect(); } else if (!once) show(false); }); const watched = new Set<Element>(); const watch = () => boxes().forEach((t) => !watched.has(t) && (watched.add(t), io.observe(t))); watch(); // safety net: styles that land after mount (display: contents) get watched too, and nothing // stays hidden for more than a moment while it is actually on screen const start = Date.now(); const net = setInterval(() => { if (shown) return once && clearInterval(net); watch(); if (Date.now() - start > 2400 && boxes().some(onScreen)) show(true); }, 600); return () => { io.disconnect(); clearInterval(net); }; }, [once]); return state; } type YkRevealFrom = "up" | "down" | "left" | "right" | "scale" | "blur" | "none"; /** Fades content in as it scrolls into view. */ function Reveal({ children, from = "up", delay = 0, duration = 700, distance = 24, once = true, as = "div", className, style, }: { children?: ReactNode; from?: YkRevealFrom; delay?: number; duration?: number; distance?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); const hidden = state === "hidden"; const offset = { up: `translate3d(0, ${distance}px, 0)`, down: `translate3d(0, ${-distance}px, 0)`, left: `translate3d(${-distance}px, 0, 0)`, right: `translate3d(${distance}px, 0, 0)`, scale: "scale(0.94)", blur: `translate3d(0, ${distance / 2}px, 0)`, none: "none", }[from]; const t = `${duration}ms ${YK_EASE} ${delay}ms`; return ( <Tag ref={ref} className={className} style={{ ...style, ...(hidden && { opacity: 0, transform: offset, filter: from === "blur" ? "blur(12px)" : undefined }), ...(state === "shown" && { transition: `opacity ${t}, transform ${t}, filter ${t}` }), }} > {children} </Tag> ); }
Quality checks
Automated, in a real browser · 4d ago- Accessible: not passedElements must meet minimum color contrast ratio thresholds (1 element)
- Responsive: passedRenders at phone (390px), tablet (768px) and desktop width without sideways scrolling.
- Dark mode: not passedElements must meet minimum color contrast ratio thresholds (1 element)
- Themeable: passedUses design tokens rather than hard-coded colours, so it follows your theme cleanly.
- Animates cleanly: passedIts animation plays and finishes with everything visible, and it stays still for people who turn on reduced motion.