// El Mirador — Editorial Map canvas + layer toggles // A stylized, minimal cartography — printed-plate aesthetic, not Google Maps. // Globals: EMMapCanvas, EMLayerToggles const { useState: useMapState } = React; const MAP_LAYERS = [ { id: "cafe", glyph: "☕", label: "Cafés tranquilos", color: "#5C3D2E" }, { id: "work", glyph: "✎", label: "Trabajo", color: "#5B5E3C" }, { id: "walk", glyph: "⌇", label: "Caminar", color: "#A37A4A" }, { id: "night", glyph: "❍", label: "Noche", color: "#2A2724" }, { id: "classic",glyph: "▢", label: "Clásicos", color: "#5C3D2E" }, { id: "new", glyph: "✦", label: "Nuevas aperturas", color: "#5B5E3C" } ]; // A small dataset of pins, positioned on a normalized 0–100 grid. const MAP_PINS = [ { id: "p1", x: 28, y: 32, layer: "cafe", label: "Don Rafael · café" }, { id: "p2", x: 52, y: 24, layer: "work", label: "Estudio Norte" }, { id: "p3", x: 70, y: 42, layer: "new", label: "Almacén 27" }, { id: "p4", x: 38, y: 58, layer: "classic", label: "Mercado de la 23" }, { id: "p5", x: 60, y: 70, layer: "night", label: "Bar Atrio" }, { id: "p6", x: 22, y: 76, layer: "cafe", label: "Tostadora Luz" }, { id: "p7", x: 80, y: 60, layer: "walk", label: "Andador de jacarandas" }, { id: "p8", x: 46, y: 44, layer: "new", label: "Librería Ínsula" }, { id: "p9", x: 64, y: 50, layer: "classic", label: "Sastrería Núñez" } ]; function EMMapCanvas({ activeLayers, onSelect }) { // Pueblo street grid — Puebla famously has a regular grid laid down in 1531. const cols = 8; const rows = 6; const layerColor = (id) => (MAP_LAYERS.find(l => l.id === id) || {}).color || "#5C3D2E"; const layerGlyph = (id) => (MAP_LAYERS.find(l => l.id === id) || {}).glyph || "•"; return (
{/* paper texture wash */} {/* parks / green spaces */} {/* boulevard — the diagonal */} {/* main street grid (Puebla traza) */} {Array.from({ length: rows + 1 }).map((_, i) => ( ))} {Array.from({ length: cols + 1 }).map((_, i) => ( ))} {/* hand-labelled streets */} CALLE 25 PONIENTE CALLE 29 PONIENTE AV. 15 NORTE AV. 25 NORTE {/* compass mark */} N {/* neighborhood label */} El Mirador {/* pins */} {MAP_PINS.map(p => { const active = activeLayers.has(p.layer); const cx = (p.x / 100) * 1000; const cy = (p.y / 100) * 600; return ( onSelect && onSelect(p)}> {layerGlyph(p.layer)} ); })}
); } function EMLayerToggles({ activeLayers, onToggle }) { return (
{MAP_LAYERS.map(l => { const on = activeLayers.has(l.id); return (
onToggle(l.id)} style={{ opacity: on ? 1 : 0.45 }}> {l.glyph} {l.label}
); })}
); } function EMMapShell() { const [active, setActive] = useMapState(new Set(MAP_LAYERS.map(l => l.id))); const [selected, setSelected] = useMapState(null); const toggle = (id) => { setActive(prev => { const next = new Set(prev); if (next.has(id)) next.delete(id); else next.add(id); return next; }); }; return (
{selected && (
{(MAP_LAYERS.find(l => l.id === selected.layer) || {}).label}
{selected.label}
Leer la historia
)}
); } Object.assign(window, { EMMapCanvas, EMLayerToggles, EMMapShell, MAP_LAYERS, MAP_PINS });