Private Office Hero
Real estate hero section: a split layout with a topographic SVG map, price pins and a drag carousel of villas.
- Heroes
- Real estate
- React only · 0 deps
- 1 file
Browser support · All evergreen browsers. Drag uses Pointer Events; arrow keys step the carousel.
Install. One command, or copy the file.
$
npx shadcn@latest add https://freedesignmd.com/r/hero-realestate-split.json- Byte-identical to the preview
- No Tailwind or config needed
- SSR-safe · keyboard accessible
- Respects reduced motion & transparency
components/heroes/hero-realestate-split.tsx
1/**2 * HeroRealestateSplit, a private-office real-estate hero in a split layout.3 * Left: editorial headline, search and a marquee of recent sales. Right: a4 * topographic coast map drawn in SVG (contours, sea soundings, the coast road,5 * village footprints, small-caps place names, graticule and scale bar) with6 * price pins that drop in and follow the selected listing, over a carousel of7 * photographed residences you can drag with momentum (spring-settled snapping)8 * or step with arrow keys.9 *10 * Props: eyebrow, title, lede, listings ({ name, area, price, beds, baths,11 * sqm, at: [x, y] in map units 0..600 × 0..700, src, alt, tag? }[]),12 * ticker ({ addr, price, delta }[]).13 * CSS vars: --fd-est-paper, --fd-est-ink, --fd-est-accent.14 *15 * Browser support: all evergreen browsers. Pins are placed with container16 * query units so they stay on their village at any panel size. Pointer17 * Events for drag.18 * Motion: drag uses a velocity-tracking spring integrator (k=380, c=30) for19 * the release snap; pins drop with --fd-spring; ticker is a CSS marquee;20 * scroll via rAF + getBoundingClientRect (map parallax, transform only).21 * prefers-reduced-motion: no marquee, instant snaps, static pins.22 * Accessibility: carousel is a region with aria-roledescription, arrow-key23 * navigation and live "n of N" status; prev/next are labelled buttons. The24 * map is decorative; every fact on it is repeated in the cards.25 */26import { useCallback, useEffect, useRef, useState } from "react";27import type { KeyboardEvent, ReactNode } from "react";28 29export type Listing = {30 name: string;31 area: string;32 price: string;33 beds: number;34 baths: number;35 sqm: number;36 /** position on the map, in SVG units (viewBox 600 × 700) */37 at: [number, number];38 src: string;39 alt: string;40 view?: string;41 tag?: string;42};43export type Sale = { addr: string; price: string; delta: string };44 45export interface HeroRealestateSplitProps {46 eyebrow?: ReactNode;47 title?: ReactNode;48 lede?: ReactNode;49 listings?: Listing[];50 ticker?: Sale[];51}52 53const DEFAULT_LISTINGS: Listing[] = [54 { name: "Casa dei Limoni", area: "Positano", view: "Sea view, lemon terrace", price: "€4,250,000", beds: 5, baths: 4, sqm: 412, at: [126, 252], src: "/img/halcyon/pool-lemons-480.webp", alt: "Infinity pool under a lemon pergola looking out over the bay", tag: "New" },55 { name: "Villa Sette Scale", area: "Praiano", view: "Courtyard pool", price: "€2,890,000", beds: 4, baths: 3, sqm: 238, at: [250, 290], src: "/img/halcyon/courtyard-pool-480.webp", alt: "Stone courtyard with a plunge pool, loungers and lemon trees, the sea beyond" },56 { name: "Palazzo Ruggi, piano nobile", area: "Ravello", view: "Vaulted rooms, 330 m up", price: "€1,975,000", beds: 3, baths: 2, sqm: 186, at: [492, 186], src: "/img/halcyon/suite-480.webp", alt: "Pale bedroom with linen drapes opening onto a terrace above the sea", tag: "Under offer" },57 { name: "Torre di Conca", area: "Conca dei Marini", view: "Watchtower, private steps", price: "€3,150,000", beds: 3, baths: 3, sqm: 201, at: [338, 314], src: "/img/halcyon/positano-sunset-480.webp", alt: "Terraced village stepping down a cliff to the sea at sunset" },58];59 60const DEFAULT_TICKER: Sale[] = [61 { addr: "Via Pasitea, Positano", price: "€6.4M", delta: "+3.1%" },62 { addr: "Via Smeraldo, Praiano", price: "€3.85M", delta: "+1.8%" },63 { addr: "Lungomare, Atrani", price: "€2.2M", delta: "−0.6%" },64 { addr: "Via San Giovanni, Ravello", price: "€4.95M", delta: "+2.4%" },65 { addr: "Fornillo, Positano", price: "€7.1M", delta: "+4.0%" },66 { addr: "Via Annunziata, Minori", price: "€1.9M", delta: "+0.9%" },67];68 69export function HeroRealestateSplit({70 eyebrow = "Private Office · Amalfi Coast",71 title = (72 <>73 Homes that rarely74 <br />75 <em>come to market.</em>76 </>77 ),78 lede = "Forty-one villas between Positano and Ravello that never reach a portal. Shown by appointment, and represented by one partner from the first viewing to the notary's signature.",79 listings = DEFAULT_LISTINGS,80 ticker = DEFAULT_TICKER,81}: HeroRealestateSplitProps) {82 const root = useRef<HTMLElement>(null);83 const track = useRef<HTMLDivElement>(null);84 const viewport = useRef<HTMLDivElement>(null);85 const map = useRef<HTMLDivElement>(null);86 const [idx, setIdx] = useState(0);87 const st = useRef({ x: 0, v: 0, target: 0, dragging: false, startX: 0, startPos: 0, lastX: 0, lastT: 0, raf: 0, step: 0 });88 const reduced = useRef(false);89 90 const apply = () => {91 if (track.current) track.current.style.transform = `translate3d(${st.current.x.toFixed(2)}px,0,0)`;92 };93 94 const measure = () => {95 const first = track.current?.children[0] as HTMLElement | undefined;96 const gap = track.current ? parseFloat(getComputedStyle(track.current).columnGap || "16") : 16;97 st.current.step = first ? first.offsetWidth + gap : 300;98 };99 100 const run = useCallback(() => {101 const s = st.current;102 if (s.raf) return;103 let last = performance.now();104 const tick = (now: number) => {105 const dt = Math.min((now - last) / 1000, 0.032);106 last = now;107 if (!s.dragging) {108 for (let i = 0; i < 2; i++) {109 const h = dt / 2;110 s.v += (-380 * (s.x - s.target) - 30 * s.v) * h;111 s.x += s.v * h;112 }113 }114 apply();115 if (!s.dragging && Math.abs(s.x - s.target) < 0.3 && Math.abs(s.v) < 0.3) {116 s.x = s.target;117 s.v = 0;118 apply();119 s.raf = 0;120 return;121 }122 s.raf = requestAnimationFrame(tick);123 };124 s.raf = requestAnimationFrame(tick);125 }, []);126 127 const go = useCallback(128 (i: number, vel = 0) => {129 const n = Math.max(0, Math.min(listings.length - 1, i));130 measure();131 st.current.target = -n * st.current.step;132 st.current.v = vel;133 setIdx(n);134 if (reduced.current) {135 st.current.x = st.current.target;136 apply();137 } else run();138 },139 [listings.length, run],140 );141 142 useEffect(() => {143 reduced.current = window.matchMedia("(prefers-reduced-motion: reduce)").matches;144 measure();145 const ro = new ResizeObserver(() => {146 measure();147 st.current.target = -idx * st.current.step;148 st.current.x = st.current.target;149 apply();150 });151 if (viewport.current) ro.observe(viewport.current);152 return () => {153 ro.disconnect();154 cancelAnimationFrame(st.current.raf);155 st.current.raf = 0;156 };157 // eslint-disable-next-line react-hooks/exhaustive-deps158 }, [idx]);159 160 // drag161 useEffect(() => {162 const vp = viewport.current;163 if (!vp) return;164 const s = st.current;165 const down = (e: PointerEvent) => {166 if (e.button !== 0 || (e.target as HTMLElement).closest("button,a")) return;167 measure();168 s.dragging = true;169 s.startX = e.clientX;170 s.startPos = s.x;171 s.lastX = e.clientX;172 s.lastT = performance.now();173 s.v = 0;174 vp.setPointerCapture(e.pointerId);175 vp.setAttribute("data-drag", "");176 run();177 };178 const move = (e: PointerEvent) => {179 if (!s.dragging) return;180 const now = performance.now();181 const dx = e.clientX - s.startX;182 const min = -(listings.length - 1) * s.step;183 let x = s.startPos + dx;184 if (x > 0) x = x * 0.35;185 if (x < min) x = min + (x - min) * 0.35;186 s.x = x;187 const dt = Math.max(1, now - s.lastT);188 s.v = s.v * 0.6 + ((e.clientX - s.lastX) / dt) * 1000 * 0.4;189 s.lastX = e.clientX;190 s.lastT = now;191 };192 const up = (e: PointerEvent) => {193 if (!s.dragging) return;194 s.dragging = false;195 vp.removeAttribute("data-drag");196 if (vp.hasPointerCapture(e.pointerId)) vp.releasePointerCapture(e.pointerId);197 // momentum: project where the throw would land198 const projected = s.x + s.v * 0.18;199 const n = Math.round(-projected / s.step);200 go(n, s.v);201 };202 vp.addEventListener("pointerdown", down);203 vp.addEventListener("pointermove", move);204 vp.addEventListener("pointerup", up);205 vp.addEventListener("pointercancel", up);206 return () => {207 vp.removeEventListener("pointerdown", down);208 vp.removeEventListener("pointermove", move);209 vp.removeEventListener("pointerup", up);210 vp.removeEventListener("pointercancel", up);211 };212 }, [go, listings.length, run]);213 214 // scroll parallax on map215 useEffect(() => {216 const el = root.current;217 if (!el || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;218 let raf = 0;219 let visible = true;220 const frame = () => {221 raf = 0;222 const r = el.getBoundingClientRect();223 const p = Math.min(1, Math.max(0, -r.top / Math.max(1, r.height)));224 if (map.current) map.current.style.transform = window.innerWidth > 900 ? `translate3d(0, ${(p * 120).toFixed(1)}px, 0) scale(${(1.04 + p * 0.1).toFixed(4)})` : "";225 if (visible && !document.hidden) raf = requestAnimationFrame(frame);226 };227 const start = () => {228 if (!raf && visible && !document.hidden) raf = requestAnimationFrame(frame);229 };230 const io = new IntersectionObserver(([e]) => {231 visible = e.isIntersecting;232 if (visible) start();233 });234 io.observe(el);235 document.addEventListener("visibilitychange", start);236 start();237 return () => {238 cancelAnimationFrame(raf);239 io.disconnect();240 document.removeEventListener("visibilitychange", start);241 };242 }, []);243 244 const onKey = (e: KeyboardEvent) => {245 if (e.key === "ArrowRight") {246 e.preventDefault();247 go(idx + 1);248 } else if (e.key === "ArrowLeft") {249 e.preventDefault();250 go(idx - 1);251 }252 };253 254 const cur = listings[idx];255 256 return (257 <section ref={root} className="fd-est" aria-label="Ashby & Vale listings">258 <style>{css}</style>259 <div className="fd-est-left">260 <p className="fd-est-eyebrow">{eyebrow}</p>261 <h1 className="fd-est-h1">{title}</h1>262 <p className="fd-est-lede">{lede}</p>263 <form className="fd-est-search" role="search" onSubmit={(e) => e.preventDefault()}>264 <label className="fd-est-sf">265 <span>Village</span>266 <input defaultValue="Positano, Ravello" aria-label="Village" />267 </label>268 <label className="fd-est-sf fd-est-sf-b">269 <span>Budget</span>270 <input defaultValue="€2M to €5M" aria-label="Budget" />271 </label>272 <button type="submit" className="fd-est-go">273 Search274 </button>275 </form>276 <div className="fd-est-ticker" aria-label="Recent sales">277 <span className="fd-est-tk-l">278 <i aria-hidden="true" />279 Sold this season280 </span>281 <div className="fd-est-tk-vp">282 <ul className="fd-est-tk">283 {[...ticker, ...ticker].map((t, i) => (284 <li key={i} aria-hidden={i >= ticker.length || undefined}>285 <span>{t.addr}</span>286 <b>{t.price}</b>287 <em className={t.delta.startsWith("−") ? "is-down" : ""}>{t.delta}</em>288 </li>289 ))}290 </ul>291 </div>292 </div>293 </div>294 295 <div className="fd-est-right">296 <div ref={map} className="fd-est-map" aria-hidden="true">297 <CoastMap />298 {listings.map((l, i) => (299 <span300 key={l.name}301 className={`fd-est-pin ${i === idx ? "is-on" : ""}`}302 style={{ ["--x" as string]: l.at[0], ["--y" as string]: l.at[1], animationDelay: `${500 + i * 140}ms` }}303 >304 <b>{shortPrice(l.price)}</b>305 </span>306 ))}307 </div>308 <div className="fd-est-mapshade" aria-hidden="true" />309 310 <div311 className="fd-est-car"312 role="region"313 aria-roledescription="carousel"314 aria-label="Featured residences"315 tabIndex={0}316 onKeyDown={onKey}317 >318 <div ref={viewport} className="fd-est-vp">319 <div ref={track} className="fd-est-track">320 {listings.map((l, i) => (321 <article key={l.name} className={`fd-est-card ${i === idx ? "is-on" : ""}`} aria-roledescription="slide" aria-label={`${i + 1} of ${listings.length}: ${l.name}`}>322 <div className="fd-est-photo">323 <img src={l.src} alt={l.alt} width={480} height={480} draggable={false} decoding="async" />324 {l.tag && <span className="fd-est-tag">{l.tag}</span>}325 <span className="fd-est-no" aria-hidden="true">{String(i + 1).padStart(2, "0")}</span>326 </div>327 <div className="fd-est-meta">328 <p>{l.area}</p>329 <h2>{l.name}</h2>330 </div>331 <div className="fd-est-row">332 <ul className="fd-est-facts">333 <li>{l.beds} bed</li>334 <li>{l.baths} bath</li>335 <li>{l.sqm} m²</li>336 </ul>337 <b>{l.price}</b>338 </div>339 {l.view && <p className="fd-est-view">{l.view}</p>}340 </article>341 ))}342 </div>343 </div>344 <div className="fd-est-ctrl">345 <span className="fd-est-status" aria-live="polite">346 <b>{String(idx + 1).padStart(2, "0")}</b> / {String(listings.length).padStart(2, "0")} · {cur.area}347 </span>348 <div className="fd-est-arrows">349 <button type="button" aria-label="Previous residence" onClick={() => go(idx - 1)} disabled={idx === 0}>350 <svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M10 3.5 5.5 8l4.5 4.5" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" /></svg>351 </button>352 <button type="button" aria-label="Next residence" onClick={() => go(idx + 1)} disabled={idx === listings.length - 1}>353 <svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M6 3.5 10.5 8 6 12.5" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" /></svg>354 </button>355 </div>356 </div>357 </div>358 </div>359 </section>360 );361}362 363function shortPrice(p: string) {364 const n = Number(p.replace(/[^0-9.]/g, ""));365 const cur = p.replace(/[0-9.,\s]/g, "");366 if (!n) return p;367 if (n >= 1e6) return `${cur}${(n / 1e6).toFixed(2).replace(/\.?0+$/, "")}M`;368 return `${cur}${Math.round(n / 1e3)}k`;369}370 371/* ───────────── Coast map: generated once at module load (pure maths, SSR safe) ───────────── */372 373// shoreline height (y) for an x across the 600-unit-wide sheet; land is above374const coastY = (x: number) =>375 292 +376 20 * Math.sin(x / 74 + 1.1) +377 9 * Math.sin(x / 23 + 0.4) +378 4 * Math.sin(x / 8.7 + 1.3) +379 30 * Math.exp(-(((x - 336) / 17) ** 2)) - // Capo di Conca380 18 * Math.exp(-(((x - 120) / 34) ** 2)) - // Positano bay381 14 * Math.exp(-(((x - 452) / 28) ** 2)); // Amalfi harbour382const smoothY = (x: number) => {383 let t = 0;384 for (let k = -4; k <= 4; k++) t += coastY(x + k * 7);385 return t / 9;386};387const XS = Array.from({ length: 111 }, (_, i) => -30 + i * 6);388const toD = (pts: number[][]) => "M" + pts.map((p) => `${p[0].toFixed(1)} ${p[1].toFixed(1)}`).join(" L");389const COAST_D = toD(XS.map((x) => [x, coastY(x)]));390const LAND_D = `${toD([[-30, -30], [630, -30], ...XS.slice().reverse().map((x) => [x, coastY(x)])])}Z`;391// land contours: near-parallel lines that tighten where the cliffs are steep392const CONTOURS = Array.from({ length: 7 }, (_, j) => {393 const k = j + 1;394 return toD(395 XS.map((x) => {396 const gap = 17 + 6 * Math.sin(x / 88 + 0.6);397 return [x, smoothY(x) - k * gap - (2 + k * 1.4) * Math.sin(x / 33 + k * 0.22) - 3 * Math.sin(x / 13 + k * 0.5)];398 }),399 );400});401// summits: wobbly closed rings402const ring = (cx: number, cy: number, r: number, seed: number) => {403 const pts = Array.from({ length: 49 }, (_, i) => {404 const a = (i / 48) * Math.PI * 2;405 const rr = r * (1 + 0.16 * Math.sin(3 * a + seed + r / 18) + 0.07 * Math.sin(5 * a + seed * 2));406 return [cx + Math.cos(a) * rr * 1.35, cy + Math.sin(a) * rr * 0.8];407 });408 return `${toD(pts)}Z`;409};410const PEAKS = [411 { x: 196, y: 96, name: "M. S. Angelo", h: "1444" },412 { x: 420, y: 108, name: "M. Cerreto", h: "1316" },413];414const SUMMITS = PEAKS.flatMap((p, i) => [10, 20, 30, 40].map((r) => ring(p.x, p.y, r, i * 2.3)));415// sea depth lines, smoothed further offshore416const DEPTHS = [26, 64, 118].map((off, i) =>417 toD(418 XS.map((x) => {419 let t = 0;420 const w = 3 + i * 3;421 for (let k = -w; k <= w; k++) t += coastY(x + k * 6);422 return [x, t / (2 * w + 1) + off];423 }),424 ),425);426const ROAD_D = toD(XS.map((x) => [x, smoothY(x) - 15 + 2.5 * Math.sin(x / 14)]));427const RAVELLO_ROAD_D = "M470 286 C462 270 486 262 478 248 C470 234 500 230 490 216 C482 204 504 200 494 188";428// village footprints: seeded tiny blocks clustered on the slopes429const hash = (n: number) => {430 const v = Math.sin(n * 127.1 + 311.7) * 43758.5453;431 return v - Math.floor(v);432};433const TOWNS = [434 { name: "Positano", x: 116, y: 252, n: 34, lx: 62, ly: 298 },435 { name: "Praiano", x: 246, y: 288, n: 18, lx: 212, ly: 252 },436 { name: "Conca dei Marini", x: 330, y: 304, n: 12, lx: 288, ly: 270 },437 { name: "Amalfi", x: 448, y: 274, n: 30, lx: 412, ly: 256 },438 { name: "Atrani", x: 476, y: 284, n: 10, lx: 462, ly: 318 },439 { name: "Ravello", x: 494, y: 192, n: 22, lx: 504, ly: 214 },440 { name: "Minori", x: 548, y: 278, n: 14, lx: 500, ly: 336 },441];442const BLOCKS = TOWNS.flatMap((t, ti) =>443 Array.from({ length: t.n }, (_, i) => {444 const a = hash(ti * 97 + i) * Math.PI * 2;445 const r = Math.sqrt(hash(ti * 31 + i * 7)) * (8 + t.n * 0.6);446 let x = t.x + Math.cos(a) * r * 1.4;447 let y = t.y + Math.sin(a) * r * 0.7;448 const limit = coastY(x) - 4;449 if (y > limit) y = limit - hash(i + ti) * 6;450 x = Math.round(x * 10) / 10;451 y = Math.round(y * 10) / 10;452 return { x, y, w: 2.4 + hash(i * 3 + ti) * 2.6, h: 2 + hash(i * 5 + ti) * 1.8, r: Math.round((hash(i * 11 + ti) - 0.5) * 50) };453 }),454);455const SOUNDINGS: [number, number, string][] = [456 [80, 352, "38"], [190, 372, "61"], [300, 404, "84"], [420, 356, "47"], [540, 372, "72"], [140, 430, "112"], [380, 452, "136"], [520, 440, "128"], [250, 470, "151"],457];458 459function CoastMap() {460 return (461 <svg aria-hidden="true" focusable="false" viewBox="0 0 600 700" preserveAspectRatio="xMidYMid slice" className="fd-est-msvg">462 <rect x="-30" y="-30" width="660" height="760" fill="#D5E0DF" />463 <g fill="none" stroke="#9FB5B7" strokeWidth="0.7" strokeDasharray="2 3">464 {DEPTHS.map((d, i) => <path key={i} d={d} opacity={0.9 - i * 0.2} />)}465 </g>466 <g className="fd-est-snd">467 {SOUNDINGS.map(([x, y, t]) => <text key={t} x={x} y={y}>{t}</text>)}468 </g>469 <path d={LAND_D} fill="#EEEAE0" />470 <g fill="none" stroke="#C9BFA6" strokeWidth="0.7">471 {CONTOURS.map((d, i) => <path key={i} d={d} strokeWidth={i === 4 ? 1.2 : 0.7} />)}472 {SUMMITS.map((d, i) => <path key={`s${i}`} d={d} strokeWidth={i % 4 === 3 ? 1.2 : 0.7} />)}473 </g>474 <path d={COAST_D} fill="none" stroke="#8FA6A8" strokeWidth="1.1" />475 <path d={COAST_D} fill="none" stroke="#D5E0DF" strokeWidth="5" opacity="0.5" transform="translate(0 3)" />476 <g fill="none" strokeLinecap="round" strokeLinejoin="round">477 <path d={ROAD_D} stroke="#B9AD93" strokeWidth="4.2" />478 <path d={RAVELLO_ROAD_D} stroke="#B9AD93" strokeWidth="3.4" />479 <path d={ROAD_D} stroke="#FBF8F1" strokeWidth="2.6" />480 <path d={RAVELLO_ROAD_D} stroke="#FBF8F1" strokeWidth="1.8" />481 </g>482 <g fill="#A99C84">483 {BLOCKS.map((b, i) => (484 <rect key={i} x={b.x} y={b.y} width={b.w.toFixed(1)} height={b.h.toFixed(1)} transform={`rotate(${b.r} ${b.x} ${b.y})`} />485 ))}486 </g>487 <g stroke="#17150F" strokeWidth="0.4" opacity="0.12">488 <path d="M200 0 V700 M400 0 V700 M0 140 H600" />489 </g>490 <g className="fd-est-grat">491 <text x="204" y="14">14°31′E</text>492 <text x="404" y="14">14°36′E</text>493 <text x="64" y="136">40°38′N</text>494 </g>495 {PEAKS.map((p) => (496 <g key={p.name} className="fd-est-peak">497 <path d={`M${p.x} ${p.y - 4} l4 7 h-8z`} fill="#6D675C" />498 <text x={p.x + 8} y={p.y + 3}>{p.name}</text>499 <text x={p.x + 8} y={p.y + 13} className="fd-est-peak-h">{p.h} m</text>500 </g>501 ))}502 <text x="150" y="292" className="fd-est-road">SS163</text>503 <g className="fd-est-town">504 {TOWNS.map((t) => <text key={t.name} x={t.lx} y={t.ly}>{t.name}</text>)}505 </g>506 <g className="fd-est-sea">507 <text x="150" y="560">Golfo di Salerno</text>508 <text x="380" y="400">Mar Tirreno</text>509 </g>510 <g transform="translate(456 62)" className="fd-est-scale">511 <path d="M0 6 H60" stroke="#17150F" strokeWidth="1" />512 <path d="M0 2 V10 M30 4 V8 M60 2 V10" stroke="#17150F" strokeWidth="1" />513 <text x="0" y="22">0</text>514 <text x="60" y="22" textAnchor="end">1 km</text>515 <path d="M84 -6 l5 14 l-5 -4 l-5 4z" fill="#17150F" />516 <text x="84" y="22" textAnchor="middle">N</text>517 </g>518 </svg>519 );520}521 522const css = `523.fd-est, .fd-est *, .fd-est *::before, .fd-est *::after { box-sizing: border-box; }524.fd-est {525 --fd-ease-out: cubic-bezier(0.22, 1, 0.36, 1);526 --fd-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);527 --fd-spring: cubic-bezier(0.34, 1.56, 0.64, 1);528 --fd-dur-1: 120ms; --fd-dur-2: 240ms; --fd-dur-3: 420ms; --fd-dur-4: 700ms;529 --fd-est-paper: #F6F3EE;530 --fd-est-ink: #17150F;531 --fd-est-muted: #6D675C;532 --fd-est-accent: #1F3B2D;533 --fd-est-serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;534 --fd-est-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;535 position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); margin: 0; padding: 0; min-height: 860px;536 background: var(--fd-est-paper); color: var(--fd-est-ink); font: 400 1rem/1.5 var(--fd-est-sans); isolation: isolate; overflow: hidden;537}538.fd-est-left { display: flex; flex-direction: column; justify-content: center; padding: 120px 56px 48px max(40px, calc(50vw - 620px)); min-width: 0; }539.fd-est-eyebrow { margin: 0 0 22px; padding: 0; font: 600 0.75rem/1 var(--fd-est-sans); letter-spacing: 0.2em; text-transform: uppercase; color: var(--fd-est-accent); animation: fd-est-rise var(--fd-dur-4) var(--fd-ease-out) 100ms both; }540.fd-est-h1 { margin: 0; padding: 0; font: 400 clamp(2.75rem, 5vw, 4.75rem)/1 var(--fd-est-serif); letter-spacing: -0.035em; color: var(--fd-est-ink); text-wrap: balance; animation: fd-est-mask 1100ms var(--fd-ease-out) 150ms both; }541.fd-est-h1 em { font-style: italic; color: var(--fd-est-accent); }542.fd-est-lede { margin: 24px 0 0; padding: 0; max-width: 30rem; font: 400 1.0625rem/1.6 var(--fd-est-sans); color: var(--fd-est-muted); letter-spacing: -0.008em; text-wrap: pretty; animation: fd-est-rise var(--fd-dur-4) var(--fd-ease-out) 350ms both; }543.fd-est-search { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 0; max-width: 520px; margin: 34px 0 0; padding: 6px; border-radius: 9999px; background: #fff; box-shadow: 0 0 0 1px rgba(23,21,15,0.08), 0 14px 30px -18px rgba(23,21,15,0.3); animation: fd-est-rise var(--fd-dur-4) var(--fd-ease-out) 450ms both; }544.fd-est-sf { display: flex; flex-direction: column; justify-content: center; gap: 3px; margin: 0; padding: 6px 18px; min-width: 0; }545.fd-est-sf-b { border-left: 1px solid rgba(23,21,15,0.1); }546.fd-est-sf span { font: 600 0.625rem/1 var(--fd-est-sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--fd-est-muted); }547.fd-est-sf input { appearance: none; -webkit-appearance: none; width: 100%; margin: 0; padding: 0; border: 0; outline: 0; background: transparent; font: 500 0.9375rem/1.3 var(--fd-est-sans); color: var(--fd-est-ink); min-width: 0; }548.fd-est-go { appearance: none; -webkit-appearance: none; cursor: pointer; margin: 0; padding: 0 24px; height: 50px; border: 0; border-radius: 9999px; background: var(--fd-est-accent); color: #F6F3EE; font: 500 0.9375rem/1 var(--fd-est-sans); transition: transform var(--fd-dur-2) var(--fd-spring), background var(--fd-dur-1); }549.fd-est-go:hover { background: #2A4D3B; }550.fd-est-go:active { transform: scale(0.96); transition-duration: var(--fd-dur-1); }551.fd-est-go:focus-visible, .fd-est-car:focus-visible, .fd-est-arrows button:focus-visible { outline: 2px solid rgba(31,59,45,0.7); outline-offset: 2px; }552.fd-est-search:focus-within { box-shadow: 0 0 0 2px rgba(31,59,45,0.4), 0 14px 30px -18px rgba(23,21,15,0.3); }553 554.fd-est-ticker { display: flex; align-items: center; gap: 16px; margin: 48px 0 0; padding: 16px 0 0; border-top: 1px solid rgba(23,21,15,0.1); min-width: 0; animation: fd-est-rise var(--fd-dur-4) var(--fd-ease-out) 600ms both; }555.fd-est-tk-l { display: inline-flex; align-items: center; gap: 8px; flex: none; font: 600 0.6875rem/1 var(--fd-est-sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--fd-est-ink); }556.fd-est-tk-l i { display: block; width: 6px; height: 6px; border-radius: 9999px; background: #C2410C; animation: fd-est-blink 1.6s var(--fd-ease-in-out) infinite; }557.fd-est-tk-vp { overflow: hidden; flex: 1; min-width: 0; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }558.fd-est-tk { display: flex; gap: 28px; width: max-content; margin: 0; padding: 0; list-style: none; animation: fd-est-marquee 36s linear infinite; }559.fd-est-ticker:hover .fd-est-tk { animation-play-state: paused; }560.fd-est-tk li { display: inline-flex; align-items: baseline; gap: 8px; margin: 0; padding: 0; white-space: nowrap; font: 400 0.8125rem/1 var(--fd-est-sans); color: var(--fd-est-muted); }561.fd-est-tk b { font: 600 0.875rem/1 var(--fd-est-sans); color: var(--fd-est-ink); font-variant-numeric: tabular-nums; }562.fd-est-tk em { font: 600 0.75rem/1 var(--fd-est-sans); font-style: normal; color: #15803D; }563.fd-est-tk em.is-down { color: #B91C1C; }564 565.fd-est-right { position: relative; min-height: 860px; overflow: hidden; clip-path: inset(0 0 0 100%); animation: fd-est-wipe 1300ms var(--fd-ease-in-out) 100ms both; background: #D5E0DF; }566.fd-est-map { position: absolute; inset: -6% 0 -6% 0; container-type: size; will-change: transform; transform: scale(1.04); }567.fd-est-msvg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }568.fd-est-msvg text { font-family: var(--fd-est-sans); }569.fd-est-town text { font-size: 8.4px; font-weight: 600; letter-spacing: 1.7px; text-transform: uppercase; fill: #3C382F; paint-order: stroke; stroke: #EEEAE0; stroke-width: 3px; stroke-linejoin: round; }570.fd-est-sea text { font: italic 400 13px var(--fd-est-serif); letter-spacing: 3px; fill: #5F7C80; }571.fd-est-snd text { font: 400 6.5px ui-monospace, "SF Mono", Menlo, monospace; fill: #7E9799; }572.fd-est-grat text, .fd-est-scale text, .fd-est-road { font: 500 6.5px ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.4px; fill: #6D675C; }573.fd-est-peak text { font-size: 7.4px; font-style: italic; fill: #6D675C; font-family: var(--fd-est-serif); }574.fd-est-peak .fd-est-peak-h { font: 400 6.2px ui-monospace, "SF Mono", Menlo, monospace; font-style: normal; }575.fd-est-mapshade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(246,243,238,0) 52%, rgba(246,243,238,0.7) 100%), linear-gradient(90deg, rgba(246,243,238,0.55), transparent 14%); }576.fd-est-pin {577 --k: max(100cqw / 600, 100cqh / 700);578 position: absolute; z-index: 1; display: block; margin: 0;579 left: calc(50% + (var(--x) - 300) * var(--k)); top: calc(50% + (var(--y) - 350) * var(--k));580 transform: translate(-50%, -100%); animation: fd-est-drop 800ms var(--fd-spring) both;581}582.fd-est-pin b {583 position: relative; display: block; margin: 0 0 9px; padding: 6px 9px; border-radius: 3px; background: #FBF9F4; color: var(--fd-est-ink); white-space: nowrap;584 font: 600 0.75rem/1 var(--fd-est-sans); font-variant-numeric: tabular-nums; letter-spacing: 0; box-shadow: 0 6px 16px -8px rgba(23,21,15,0.45), 0 0 0 1px rgba(23,21,15,0.14);585 transition: background var(--fd-dur-3) var(--fd-ease-out), color var(--fd-dur-3) var(--fd-ease-out), transform var(--fd-dur-3) var(--fd-spring);586}587.fd-est-pin b::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 8px; height: 8px; margin-left: -4px; background: inherit; transform: rotate(45deg); box-shadow: 1px 1px 0 rgba(23,21,15,0.14); }588.fd-est-pin::before { content: ""; position: absolute; left: 50%; bottom: -3px; width: 6px; height: 6px; margin-left: -3px; border-radius: 9999px; background: var(--fd-est-ink); box-shadow: 0 0 0 2px #FBF9F4; }589.fd-est-pin::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; margin: 0 0 0 -5px; border-radius: 9999px; background: rgba(31,59,45,0.35); opacity: 0; }590.fd-est-pin.is-on { z-index: 2; }591.fd-est-pin.is-on b { background: var(--fd-est-accent); color: #F6F3EE; transform: scale(1.1) translateY(-3px); }592.fd-est-pin.is-on::before { background: var(--fd-est-accent); }593.fd-est-pin.is-on::after { opacity: 1; animation: fd-est-pulse 2s var(--fd-ease-out) infinite; }594 595.fd-est-car { position: absolute; left: 32px; right: 0; bottom: 36px; outline: none; animation: fd-est-rise 1000ms var(--fd-ease-out) 800ms both; }596.fd-est-vp { overflow: hidden; margin: 0; padding: 20px 0 24px 0; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }597.fd-est-vp[data-drag] { cursor: grabbing; }598.fd-est-track { display: flex; column-gap: 16px; will-change: transform; }599.fd-est-card {600 flex: none; width: 292px; margin: 0; padding: 8px 8px 14px; border-radius: 4px; background: #FBF9F4;601 box-shadow: 0 0 0 1px rgba(23,21,15,0.08), 0 20px 40px -26px rgba(23,21,15,0.4);602 transform: scale(0.95); transform-origin: left bottom;603 transition: transform var(--fd-dur-4) var(--fd-spring), box-shadow var(--fd-dur-3);604}605.fd-est-card:not(.is-on) .fd-est-photo img { filter: saturate(0.55) brightness(1.06); }606.fd-est-card.is-on { opacity: 1; transform: none; box-shadow: 0 0 0 1px rgba(23,21,15,0.08), 0 30px 60px -26px rgba(23,21,15,0.5); }607.fd-est-photo { position: relative; overflow: hidden; height: 172px; margin: 0; border-radius: 2px; background: #DCD6CA; }608.fd-est-photo img { display: block; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; object-fit: cover; pointer-events: none; transform: scale(1.06); transition: transform 1200ms var(--fd-ease-out), filter var(--fd-dur-3) var(--fd-ease-out); }609.fd-est-card.is-on .fd-est-photo img { transform: none; }610.fd-est-tag { position: absolute; left: 8px; top: 8px; margin: 0; padding: 5px 8px; border-radius: 2px; background: #FBF9F4; color: var(--fd-est-ink); font: 600 0.625rem/1 var(--fd-est-sans); letter-spacing: 0.12em; text-transform: uppercase; }611.fd-est-no { position: absolute; right: 10px; bottom: 8px; margin: 0; font: 400 1.5rem/1 var(--fd-est-serif); font-style: italic; color: #FBF9F4; text-shadow: 0 1px 12px rgba(0,0,0,0.35); }612.fd-est-meta { margin: 12px 4px 0; padding: 0; }613.fd-est-meta p { margin: 0; padding: 0; font: 600 0.625rem/1.2 var(--fd-est-sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--fd-est-accent); }614.fd-est-meta h2 { margin: 5px 0 0; padding: 0; font: 400 1.1875rem/1.15 var(--fd-est-serif); letter-spacing: -0.01em; color: var(--fd-est-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }615.fd-est-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 10px 4px 0; padding: 10px 0 0; border-top: 1px solid rgba(23,21,15,0.1); }616.fd-est-row b { flex: none; font: 600 0.9375rem/1 var(--fd-est-sans); color: var(--fd-est-ink); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }617.fd-est-facts { display: flex; gap: 0; margin: 0; padding: 0; list-style: none; }618.fd-est-facts li { margin: 0; padding: 0 8px; border-left: 1px solid rgba(23,21,15,0.14); font: 500 0.75rem/1 var(--fd-est-sans); color: var(--fd-est-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }619.fd-est-facts li:first-child { padding-left: 0; border-left: 0; }620.fd-est-view { margin: 8px 4px 0; padding: 0; font: italic 400 0.8125rem/1.2 var(--fd-est-serif); color: var(--fd-est-muted); }621.fd-est-ctrl { display: flex; justify-content: space-between; align-items: center; margin: 0; padding: 0 32px 0 0; }622.fd-est-status { font: 400 0.8125rem/1 var(--fd-est-sans); color: var(--fd-est-muted); }623.fd-est-status b { font: 600 0.8125rem/1 var(--fd-est-sans); color: var(--fd-est-ink); font-variant-numeric: tabular-nums; }624.fd-est-arrows { display: flex; gap: 8px; }625.fd-est-arrows button { appearance: none; -webkit-appearance: none; cursor: pointer; display: grid; place-items: center; width: 42px; height: 42px; margin: 0; padding: 0; border-radius: 9999px; border: 0; background: #FBF9F4; color: var(--fd-est-ink); box-shadow: 0 0 0 1px rgba(23,21,15,0.14); transition: transform var(--fd-dur-2) var(--fd-spring), opacity var(--fd-dur-2), background var(--fd-dur-1); }626.fd-est-arrows button:hover:not(:disabled) { background: #fff; }627.fd-est-arrows button svg { display: block; }628.fd-est-arrows button:active { transform: scale(0.92); transition-duration: var(--fd-dur-1); }629.fd-est-arrows button:disabled { opacity: 0.35; cursor: default; }630 631@keyframes fd-est-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }632@keyframes fd-est-mask { from { opacity: 0; clip-path: inset(0 0 100% 0); transform: translateY(24px); } to { opacity: 1; clip-path: inset(0 0 -10% 0); transform: none; } }633@keyframes fd-est-wipe { to { clip-path: inset(0 0 0 0); } }634@keyframes fd-est-drop { from { opacity: 0; transform: translate(-50%, -260%); } to { opacity: 1; transform: translate(-50%, -100%); } }635@keyframes fd-est-pulse { 0% { transform: scale(0.6); opacity: 0.8; } 100% { transform: scale(3.2); opacity: 0; } }636@keyframes fd-est-marquee { to { transform: translateX(-50%); } }637@keyframes fd-est-blink { 50% { opacity: 0.3; } }638 639@media (max-width: 900px) {640 .fd-est { grid-template-columns: 1fr; min-height: 844px; }641 .fd-est-left { padding: 96px 20px 28px; }642 .fd-est-lede { font-size: 0.9375rem; margin-top: 16px; }643 .fd-est-search { grid-template-columns: 1fr auto; margin-top: 24px; }644 .fd-est-sf-b { display: none; }645 .fd-est-ticker { margin-top: 24px; }646 .fd-est-right { min-height: 0; display: flex; flex-direction: column; background: var(--fd-est-paper); }647 .fd-est-map { position: relative; inset: auto; flex: none; height: 560px; width: 125%; margin: 0 0 0 -12.5%; transform: none; }648 .fd-est-mapshade { height: 330px; bottom: auto; background: linear-gradient(180deg, rgba(246,243,238,0) 70%, rgba(246,243,238,0.9) 100%); }649 .fd-est-car { position: relative; left: auto; right: auto; bottom: auto; margin: -280px 0 0; padding: 0 0 24px 16px; z-index: 2; }650 .fd-est-town text { font-size: 10px; letter-spacing: 1.6px; }651 .fd-est-sea text { font-size: 14px; }652 .fd-est-grat text, .fd-est-scale text, .fd-est-road, .fd-est-snd text { font-size: 8px; }653 .fd-est-peak text { font-size: 9px; }654 .fd-est-vp { padding-top: 0; }655 .fd-est-card { width: 264px; }656 .fd-est-photo { height: 150px; }657 .fd-est-ctrl { padding-right: 16px; }658}659@media (prefers-reduced-motion: reduce) {660 .fd-est *, .fd-est *::before, .fd-est *::after, .fd-est-right { animation: none !important; }661 .fd-est-right { clip-path: none; }662}663@media (prefers-reduced-transparency: reduce) { .fd-est-tag { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; } }664`;665 666/* ───────────────────────── Demo ───────────────────────── */667 668export function Demo() {669 return (670 <div className="fd-est-demo">671 <style>{demoCss}</style>672 <header className="fd-est-demo-nav">673 <a className="fd-est-demo-logo" href="#top">674 Ashby <i>&</i> Vale675 </a>676 <nav aria-label="Primary">677 <a href="#buy">Buy</a>678 <a href="#sell">Sell</a>679 <a href="#lettings">Lettings</a>680 <a href="#journal">Journal</a>681 </nav>682 <a className="fd-est-demo-cta" href="#valuation">Book a valuation</a>683 </header>684 <HeroRealestateSplit />685 </div>686 );687}688 689const demoCss = `690.fd-est-demo { position: relative; margin: 0; padding: 0; min-height: 100vh; background: #F6F3EE; }691.fd-est-demo *, .fd-est-demo *::before, .fd-est-demo *::after { box-sizing: border-box; }692.fd-est-demo-nav { position: absolute; z-index: 10; top: 0; left: 0; width: 50%; height: 76px; margin: 0; padding: 0 56px 0 max(40px, calc(50vw - 620px)); display: flex; align-items: center; justify-content: space-between; gap: 20px; }693.fd-est-demo-nav .fd-est-demo-logo { margin: 0; color: #17150F; text-decoration: none; font: 400 1.375rem/1 ui-serif, "New York", "Iowan Old Style", Georgia, serif; letter-spacing: -0.02em; white-space: nowrap; }694.fd-est-demo-logo i { font-style: italic; color: #1F3B2D; }695.fd-est-demo-nav nav { display: flex; gap: 24px; }696.fd-est-demo-nav a { color: #4A453B; text-decoration: none; font: 500 0.875rem/1 ui-sans-serif, -apple-system, "Inter", sans-serif; }697.fd-est-demo-nav .fd-est-demo-cta { display: none; }698.fd-est-demo-nav a:focus-visible { outline: 2px solid rgba(31,59,45,.7); outline-offset: 2px; border-radius: 6px; }699@media (max-width: 1100px) { .fd-est-demo-nav nav { display: none; } }700@media (max-width: 900px) { .fd-est-demo-nav { width: 100%; padding: 0 20px; height: 64px; } .fd-est-demo-nav .fd-est-demo-cta { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 9999px; background: #1F3B2D; color: #F6F3EE; } }701`;More Heroes. Same file contract.
Questions about Private Office Hero
Run npx shadcn@latest add https://freedesignmd.com/r/hero-realestate-split.json, or open the page and copy the file into your project. It has zero dependencies besides React. What you copy is the exact file that renders the live demo.
Real estate hero section: a split layout with a topographic SVG map, price pins and a drag carousel of villas. It is a free, MIT-licensed React heroes component from the freedesignmd library.
Yes. It is free and MIT-licensed, use, modify and ship it in personal and commercial projects without attribution.
All evergreen browsers. Drag uses Pointer Events; arrow keys step the carousel.
Yes. It is a plain React component with its own styles, so it runs in Next.js, Vite, Remix and Lovable projects, and it needs no Tailwind setup. It has zero dependencies besides React.


