Page sections / Calls to action
Dual Overlay Photo CTA Cards
Two square rounded (16px) photo cards side by side. Left is a documentary image with a vertical mono location tag and a 'Labs' bracket logotype; right is a blurred green macro with floating capsules. Each carries centered light text and a white pill button.
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
Pass leftImage/rightImage, titles, texts, CTA labels and hrefs as props; all have defaults. Buttons invert to green on hover and photos slowly zoom.
components/split-cta-photo-cards.tsx
"use client"; import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; export default function DualOverlayPhotoCtaCards({ leftImage = "https://yoink-app.fly.dev/stock/people-3.jpg", rightImage = "https://yoink-app.fly.dev/stock/nature-2.jpg", leftTitle = "Fern", leftTitleSuffix = "Field", leftText = "Research that follows people outdoors.", leftCta = "Learn More", leftHref = "#", tag = "Lofoten, Norway — Field Site", rightTitle = "Rethink your daily routine for good.", rightText = "Notice steady energy within two weeks of starting.", rightCta = "Get Started", rightHref = "#", }: { leftImage?: string; rightImage?: string; leftTitle?: string; leftTitleSuffix?: string; leftText?: string; leftCta?: string; leftHref?: string; tag?: string; rightTitle?: string; rightText?: string; rightCta?: string; rightHref?: string; }) { const btn = "inline-flex items-center rounded-pill bg-pure-white px-6 py-4 text-label text-ink transition-all duration-ui-hover ease-ui-hover hover:bg-ink hover:text-canvas focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-canvas"; const img = "absolute inset-0 h-full w-full object-cover transition-transform duration-[2000ms] ease-out group-hover:scale-105 motion-reduce:transition-none"; return ( <section className="bg-canvas px-4 py-16 font-sans text-canvas md:px-8"> <div className="mx-auto grid max-w-[1376px] gap-4 md:grid-cols-2 md:gap-8"> <Reveal from="up"> <article className="group relative isolate aspect-square overflow-hidden rounded-[16px] bg-ink"> <img src={leftImage} alt="Person reaching up among coastal rocks" width={1280} height={853} loading="lazy" className={img} /> <div className="absolute inset-0 bg-scrim" /> <div className="absolute left-[18px] top-1/2 flex -translate-y-1/2 flex-col items-center gap-3"> <span className="h-[11px] w-[11px] rounded-full bg-canvas" /> <span className="font-mono text-[11px] uppercase tracking-wider text-canvas [writing-mode:vertical-rl]">{tag}</span> </div> <div className="absolute inset-0 flex flex-col items-center justify-center px-8 text-center"> <h3 className="text-h2 font-light"> {leftTitle} <span className="mx-1 font-extralight">【</span> {leftTitleSuffix} <span className="mx-1 font-extralight">】</span> </h3> <p className="mt-4 text-body">{leftText}</p> <a href={leftHref} className={`${btn} mt-6`}>{leftCta}</a> </div> </article> </Reveal> <Reveal from="up" delay={120}> <article className="group relative isolate aspect-square overflow-hidden rounded-[16px] bg-forest-soft"> <img src={rightImage} alt="" width={1600} height={1200} loading="lazy" className={`${img} blur-sm scale-110`} /> <div className="absolute inset-0 bg-ink/30" /> <div className="absolute inset-0 flex flex-col items-center justify-center px-8 text-center"> <div className="mb-6 flex gap-1" aria-hidden="true"> <span className="h-[72px] w-[26px] rounded-pill bg-gradient-to-b from-forest-soft to-ink shadow-capsule-drop ring-1 ring-canvas/20" /> <span className="h-[72px] w-[26px] rounded-pill bg-gradient-to-b from-forest-soft to-ink shadow-capsule-drop ring-1 ring-canvas/20" /> </div> <h3 className="text-h3 font-light">{rightTitle}</h3> <p className="mt-5 text-body">{rightText}</p> <a href={rightHref} className={`${btn} mt-6`}>{rightCta}</a> </div> </article> </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 { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; export default function DualOverlayPhotoCtaCards({ leftImage = "https://yoink-app.fly.dev/stock/people-3.jpg", rightImage = "https://yoink-app.fly.dev/stock/nature-2.jpg", leftTitle = "Fern", leftTitleSuffix = "Field", leftText = "Research that follows people outdoors.", leftCta = "Learn More", leftHref = "#", tag = "Lofoten, Norway — Field Site", rightTitle = "Rethink your daily routine for good.", rightText = "Notice steady energy within two weeks of starting.", rightCta = "Get Started", rightHref = "#", }: { leftImage?: string; rightImage?: string; leftTitle?: string; leftTitleSuffix?: string; leftText?: string; leftCta?: string; leftHref?: string; tag?: string; rightTitle?: string; rightText?: string; rightCta?: string; rightHref?: string; }) { const btn = "inline-flex items-center rounded-full bg-muted px-6 py-4 text-verdant-label text-primary-foreground transition-all duration-verdant-ui-hover ease-verdant-ui-hover hover:bg-primary hover:text-primary-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-background"; const img = "absolute inset-0 h-full w-full object-cover transition-transform duration-[2000ms] ease-out group-hover:scale-105 motion-reduce:transition-none"; return ( <section className="bg-background px-4 py-16 font-sans text-background md:px-8"> <div className="mx-auto grid max-w-[1376px] gap-4 md:grid-cols-2 md:gap-8"> <Reveal from="up"> <article className="group relative isolate aspect-square overflow-hidden rounded-[16px] bg-foreground"> <img src={leftImage} alt="Person reaching up among coastal rocks" width={1280} height={853} loading="lazy" className={img} /> <div className="absolute inset-0 bg-foreground" /> <div className="absolute left-[18px] top-1/2 flex -translate-y-1/2 flex-col items-center gap-3"> <span className="h-[11px] w-[11px] rounded-full bg-background" /> <span className="font-mono text-[11px] uppercase tracking-wider text-background [writing-mode:vertical-rl]">{tag}</span> </div> <div className="absolute inset-0 flex flex-col items-center justify-center px-8 text-center"> <h3 className="text-verdant-h2 font-light"> {leftTitle} <span className="mx-1 font-extralight">【</span> {leftTitleSuffix} <span className="mx-1 font-extralight">】</span> </h3> <p className="mt-4 text-verdant-body">{leftText}</p> <a href={leftHref} className={`${btn} mt-6`}>{leftCta}</a> </div> </article> </Reveal> <Reveal from="up" delay={120}> <article className="group relative isolate aspect-square overflow-hidden rounded-[16px] bg-foreground"> <img src={rightImage} alt="" width={1600} height={1200} loading="lazy" className={`${img} blur-sm scale-110`} /> <div className="absolute inset-0 bg-foreground/30" /> <div className="absolute inset-0 flex flex-col items-center justify-center px-8 text-center"> <div className="mb-6 flex gap-1" aria-hidden="true"> <span className="h-[72px] w-[26px] rounded-full bg-gradient-to-b from-foreground to-foreground shadow-verdant-capsule-drop ring-1 ring-background/20" /> <span className="h-[72px] w-[26px] rounded-full bg-gradient-to-b from-foreground to-foreground shadow-verdant-capsule-drop ring-1 ring-background/20" /> </div> <h3 className="text-verdant-h3 font-light">{rightTitle}</h3> <p className="mt-5 text-verdant-body">{rightText}</p> <a href={rightHref} className={`${btn} mt-6`}>{rightCta}</a> </div> </article> </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: passedNo serious accessibility problems (axe-core): readable contrast, labelled buttons and images.
- 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.