Twin-Panel Project Slideshow Hero
Two equal square-ish full-bleed media panels (photo/video left, brand artwork right) on a 12-col grid with 12px gutter, no radius. Below: bold black project name followed by grey description, a small arrow-up-right glyph, and a row of thin segmented progress bars on the right. Placeholder is flat 5% black.
Rebuilt from thisislandscape.com in the Gallery White Editorial style.
Looks exactly like thisislandscape.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 `slides` (name, description, image, gradient colours), `nav`, `logo` and `interval` (ms per slide). It auto-advances with cross-fade and filling progress bars; click a bar to jump.
components/split-hero-slideshow.tsx
"use client"; import { useLayoutEffect, useRef, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useEffect, useState } from "react"; const DEFAULT_SLIDES = [ { name: "Northfold", description: "Lifting repeat bookings by 40% for the largest independent cycling tour operator.", image: "https://yoink-app.fly.dev/stock/architecture-2.jpg", from: "#b45309", via: "#c2410c", to: "#7f1d1d" }, { name: "Kitefield", description: "A calmer identity for a regional network of urban community gardens.", image: "https://yoink-app.fly.dev/stock/city-4.jpg", from: "#0f766e", via: "#115e59", to: "#134e4a" }, { name: "Altura", description: "Rebuilding trust with a new brand system for a mountain lodge collective.", image: "https://yoink-app.fly.dev/stock/landscape-2.jpg", from: "#4338ca", via: "#3730a3", to: "#1e1b4b" }, ]; export default function TwinPanelProjectSlideshowHero({ logo = "Gallery", nav = ["Work", "Profile", "News", "Events", "Contact"], slides = DEFAULT_SLIDES, interval = 4000, }: { logo?: string; nav?: string[]; slides?: typeof DEFAULT_SLIDES; interval?: number; }) { const [i, setI] = useState(0); useEffect(() => { const t = setTimeout(() => setI((v) => (v + 1) % slides.length), interval); return () => clearTimeout(t); }, [i, interval, slides.length]); const s = slides[i]; return ( <section className="bg-canvas font-sans text-ink px-4 pb-6"> <header className="flex items-start justify-between pt-3 pb-12"> <a href="#" className="font-serif-logo text-3xl tracking-tight focus-visible:outline focus-visible:outline-2">{logo}</a> <nav aria-label="Primary" className="flex"> {nav.map((n) => ( <a key={n} href="#" className="rounded-pill border border-hairline px-2 py-0.5 text-body-small text-ink-muted transition-colors duration-pill-hover ease-pill-hover hover:border-ink hover:text-ink focus-visible:outline focus-visible:outline-2">{n}</a> ))} </nav> </header> <Reveal from="none" duration={1000}> <div className="grid grid-cols-1 gap-3 md:grid-cols-2"> <div className="relative aspect-square bg-placeholder overflow-hidden"> {slides.map((sl, k) => ( <img key={sl.name} src={sl.image} alt={k === i ? sl.name + " project imagery" : ""} width={698} height={691} loading={k === 0 ? undefined : "lazy"} className={"absolute inset-0 h-full w-full object-cover transition-opacity duration-media-fade-in ease-media-fade-in " + (k === i ? "opacity-100" : "opacity-0")} /> ))} </div> <div className="relative aspect-square overflow-hidden bg-placeholder"> {slides.map((sl, k) => ( <div key={sl.name} aria-hidden={k !== i} className={"absolute inset-0 flex items-center justify-center transition-opacity duration-1000 " + (k === i ? "opacity-100" : "opacity-0")} style={{ background: `radial-gradient(70% 60% at 25% 25%, ${sl.via}, transparent 70%), radial-gradient(60% 60% at 85% 80%, ${sl.from}cc, transparent 70%), linear-gradient(135deg, ${sl.from}, ${sl.to})` }}> <span className="text-5xl font-medium tracking-tight text-[#fde68a] md:text-6xl">{sl.name}</span> </div> ))} </div> </div> <div className="mt-2 grid grid-cols-1 gap-3 md:grid-cols-2"> <div> <p className="text-statement"><span className="font-semibold text-ink">{s.name}</span> <span className="text-ink-muted">{s.description}</span></p> <a href="#" aria-label={"View " + s.name} className="mt-2 inline-block focus-visible:outline focus-visible:outline-2"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="2"><path d="M2 14L13 3M5 2h9v9" /></svg> </a> </div> <div className="flex items-start justify-end gap-1 pt-2" role="tablist" aria-label="Slides"> {slides.map((sl, k) => ( <button key={sl.name} role="tab" aria-selected={k === i} aria-label={"Show " + sl.name} onClick={() => setI(k)} className="relative h-0.5 w-6 overflow-hidden bg-placeholder"> <span key={k === i ? "on" + i : "off"} className="absolute inset-0 origin-left bg-ink" style={{ transform: k < i ? "scaleX(1)" : "scaleX(0)", animation: k === i ? `bar ${interval}ms linear forwards` : undefined }} /> </button> ))} </div> </div> </Reveal> <style>{"@keyframes bar{from{transform:scaleX(0)}to{transform:scaleX(1)}}@media (prefers-reduced-motion:reduce){*{animation-duration:0s!important}}"}</style> </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"; const DEFAULT_SLIDES = [ { name: "Northfold", description: "Lifting repeat bookings by 40% for the largest independent cycling tour operator.", image: "https://yoink-app.fly.dev/stock/architecture-2.jpg", from: "#b45309", via: "#c2410c", to: "#7f1d1d" }, { name: "Kitefield", description: "A calmer identity for a regional network of urban community gardens.", image: "https://yoink-app.fly.dev/stock/city-4.jpg", from: "#0f766e", via: "#115e59", to: "#134e4a" }, { name: "Altura", description: "Rebuilding trust with a new brand system for a mountain lodge collective.", image: "https://yoink-app.fly.dev/stock/landscape-2.jpg", from: "#4338ca", via: "#3730a3", to: "#1e1b4b" }, ]; export default function TwinPanelProjectSlideshowHero({ logo = "Gallery", nav = ["Work", "Profile", "News", "Events", "Contact"], slides = DEFAULT_SLIDES, interval = 4000, }: { logo?: string; nav?: string[]; slides?: typeof DEFAULT_SLIDES; interval?: number; }) { const [i, setI] = useState(0); useEffect(() => { const t = setTimeout(() => setI((v) => (v + 1) % slides.length), interval); return () => clearTimeout(t); }, [i, interval, slides.length]); const s = slides[i]; return ( <section className="bg-background font-sans text-foreground px-4 pb-6"> <header className="flex items-start justify-between pt-3 pb-12"> <a href="#" className="font-sans text-3xl tracking-tight focus-visible:outline focus-visible:outline-2">{logo}</a> <nav aria-label="Primary" className="flex"> {nav.map((n) => ( <a key={n} href="#" className="rounded-full border border-border px-2 py-0.5 text-gallery-body-small text-muted-foreground transition-colors duration-gallery-pill-hover ease-gallery-pill-hover hover:border-foreground hover:text-foreground focus-visible:outline focus-visible:outline-2">{n}</a> ))} </nav> </header> <Reveal from="none" duration={1000}> <div className="grid grid-cols-1 gap-3 md:grid-cols-2"> <div className="relative aspect-square bg-foreground overflow-hidden"> {slides.map((sl, k) => ( <img key={sl.name} src={sl.image} alt={k === i ? sl.name + " project imagery" : ""} width={698} height={691} loading={k === 0 ? undefined : "lazy"} className={"absolute inset-0 h-full w-full object-cover transition-opacity duration-gallery-media-fade-in ease-gallery-media-fade-in " + (k === i ? "opacity-100" : "opacity-0")} /> ))} </div> <div className="relative aspect-square overflow-hidden bg-foreground"> {slides.map((sl, k) => ( <div key={sl.name} aria-hidden={k !== i} className={"absolute inset-0 flex items-center justify-center transition-opacity duration-1000 " + (k === i ? "opacity-100" : "opacity-0")} style={{ background: `radial-gradient(70% 60% at 25% 25%, ${sl.via}, transparent 70%), radial-gradient(60% 60% at 85% 80%, ${sl.from}cc, transparent 70%), linear-gradient(135deg, ${sl.from}, ${sl.to})` }}> <span className="text-5xl font-medium tracking-tight text-[#fde68a] md:text-6xl">{sl.name}</span> </div> ))} </div> </div> <div className="mt-2 grid grid-cols-1 gap-3 md:grid-cols-2"> <div> <p className="text-gallery-statement"><span className="font-semibold text-foreground">{s.name}</span> <span className="text-muted-foreground">{s.description}</span></p> <a href="#" aria-label={"View " + s.name} className="mt-2 inline-block focus-visible:outline focus-visible:outline-2"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="2"><path d="M2 14L13 3M5 2h9v9" /></svg> </a> </div> <div className="flex items-start justify-end gap-1 pt-2" role="tablist" aria-label="Slides"> {slides.map((sl, k) => ( <button key={sl.name} role="tab" aria-selected={k === i} aria-label={"Show " + sl.name} onClick={() => setI(k)} className="relative h-0.5 w-6 overflow-hidden bg-foreground"> <span key={k === i ? "on" + i : "off"} className="absolute inset-0 origin-left bg-foreground" style={{ transform: k < i ? "scaleX(1)" : "scaleX(0)", animation: k === i ? `bar ${interval}ms linear forwards` : undefined }} /> </button> ))} </div> </div> </Reveal> <style>{"@keyframes bar{from{transform:scaleX(0)}to{transform:scaleX(1)}}@media (prefers-reduced-motion:reduce){*{animation-duration:0s!important}}"}</style> </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 (6 elements)
- Responsive: not passedScrolls sideways at phone width (390px)
- Dark mode: passedStill readable when installed in your theme and switched to dark mode.
- Themeable: not passed1 hard-coded colour (text-[#fde68a]). These ignore the theme and break dark mode.
- Animates cleanly: passedIts animation plays and finishes with everything visible, and it stays still for people who turn on reduced motion.