// === Reusable primitives === const GoldRule = ({ className = "" }) =>
; const GoldDot = () => ; const Eyebrow = ({ children, className = "" }) => (
{children}
); const SectionTitle = ({ eyebrow, title, lead, center, className = "" }) => (
{eyebrow && {eyebrow}}

{title}

{lead && (

{lead}

)}
); // Buttons const BtnPrimary = ({ href, onClick, children, className = "", icon = true, ...rest }) => { const Tag = href ? "a" : "button"; return ( {icon && } {children} ); }; const BtnGhost = ({ href, onClick, children, className = "", ...rest }) => { const Tag = href ? "a" : "button"; return ( {children} ); }; // === Book cover (typographic placeholder, editorial) === const BookCover = ({ book, large = false }) => { const coverUrl = (book.image_urls && book.image_urls.length > 0) ? book.image_urls[0] : book.image_url; if (coverUrl) { return (
{book.title}
); } const palettes = { coal: "typo-cover", red: "typo-cover r", blue: "typo-cover b", ivory: "typo-cover i", green: "typo-cover g", plum: "typo-cover p", }; const cls = palettes[book.cover.palette] || "typo-cover"; const isLight = book.cover.palette === "ivory"; return (
Psicología · Libros
{(book.cover.short || "").replace(/\\n/g, "\n")}
{book.author}
); }; // === Status pill === const StatusPill = ({ status }) => { const map = { disponible: { label: "Disponible", color: "#3d7a4a" }, consultar: { label: "Consultar", color: "#A4842F" }, agotado: { label: "Agotado", color: "#8B1A1A" }, por_encargo: { label: "Por encargo", color: "#4A4A4A" }, }; const s = map[status] || map.consultar; return ( {s.label} ); }; // === Book card === const BookCard = ({ book }) => { const msg = `Hola, me interesa el libro "${book.title}" de Psicología Libros. ¿Me podés dar más información?`; const detailHref = `libro.html?id=${book.id}`; return (
{/* Portada */}
{/* Category + status */}
{catName(book.category)}
{/* Title */}

{book.title}

por {book.author}

{/* Price */}
Precio
{typeof window.formatPrecioGs === "function" ? window.formatPrecioGs(book.price) : book.price}
{/* Actions */}
); }; // === Category card === const CategoryCard = ({ cat, onClick }) => { const I = cat.Icon; return ( ); }; // === Benefit card === const BenefitCard = ({ b }) => { const I = b.Icon; return (

{b.title}

{b.desc}

); }; // === FAQ item === const FAQItem = ({ item, open, onToggle, idx }) => { return (

{item.a}

); }; Object.assign(window, { GoldRule, GoldDot, Eyebrow, SectionTitle, BtnPrimary, BtnGhost, BookCover, StatusPill, BookCard, CategoryCard, BenefitCard, FAQItem, });