feat: modelo de bloques en el extractor, reconstruidas citas e imágenes de gráficas
This commit is contained in:
+56
@@ -173,6 +173,62 @@ img {
|
|||||||
margin: 0.5rem 0;
|
margin: 0.5rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Cita destacada (parrafo en cursiva con borde horizontal en el original:
|
||||||
|
ver is_pull_quote() en scripts/extract_site.py) */
|
||||||
|
.section-quote {
|
||||||
|
font-family: var(--font-body);
|
||||||
|
font-style: italic;
|
||||||
|
font-size: 1.3rem;
|
||||||
|
line-height: 1.3;
|
||||||
|
margin: 1.75rem 0;
|
||||||
|
padding: 1.1rem 1.25rem;
|
||||||
|
border-top: 2px solid #e2e2e2;
|
||||||
|
border-bottom: 2px solid #e2e2e2;
|
||||||
|
}
|
||||||
|
.section--hero .section-quote {
|
||||||
|
border-color: rgba(255, 255, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Foto de fondo a pantalla completa de un contenedor Elementor (ver
|
||||||
|
background_image en scripts/extract_site.py). Se sale del ancho maximo
|
||||||
|
de .section-inner para ser full-bleed de verdad. */
|
||||||
|
.section-banner {
|
||||||
|
width: 100vw;
|
||||||
|
margin-inline: calc(50% - 50vw);
|
||||||
|
margin-block: 2.5rem;
|
||||||
|
min-height: 55vh;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Rejilla de tarjetas (p.ej. "Algunos mitos sobre la inmigracion...": ver
|
||||||
|
is_card_row() en scripts/extract_site.py) */
|
||||||
|
.section-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
||||||
|
gap: 1.25rem;
|
||||||
|
margin: 1.75rem 0;
|
||||||
|
}
|
||||||
|
.section-grid-card {
|
||||||
|
border: 1px solid #e4e4e4;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 1.75rem 1rem 1.25rem;
|
||||||
|
box-shadow: 0 2px 10px rgba(15, 23, 43, 0.06);
|
||||||
|
transition: box-shadow 0.2s ease;
|
||||||
|
}
|
||||||
|
.section-grid-card:hover {
|
||||||
|
box-shadow: 0 4px 18px rgba(15, 23, 43, 0.14);
|
||||||
|
}
|
||||||
|
.section-grid-card .section-heading {
|
||||||
|
font-size: 1.15rem;
|
||||||
|
margin-bottom: 0.6rem;
|
||||||
|
}
|
||||||
|
.section-grid-card .section-paragraph {
|
||||||
|
font-size: 0.95rem;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* ------- Footer ------- */
|
/* ------- Footer ------- */
|
||||||
.site-footer {
|
.site-footer {
|
||||||
background: var(--color-bg-dark);
|
background: var(--color-bg-dark);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export default function Section({ section, variant = 'default' }) {
|
|||||||
return (
|
return (
|
||||||
<section id={anchor} className={`section section--${variant}`}>
|
<section id={anchor} className={`section section--${variant}`}>
|
||||||
<div className="section-inner">
|
<div className="section-inner">
|
||||||
<Content {...section} truncate />
|
<Content blocks={section.blocks} />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export default function Accordion({ items = [] }) {
|
|||||||
</button>
|
</button>
|
||||||
{isOpen && (
|
{isOpen && (
|
||||||
<div className="pa-accordion-panel">
|
<div className="pa-accordion-panel">
|
||||||
<Content {...item} />
|
<Content blocks={item.blocks} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default function Carousel({ slides = [] }) {
|
|||||||
<div className="pa-carousel-track" ref={trackRef}>
|
<div className="pa-carousel-track" ref={trackRef}>
|
||||||
{slides.map((slide, i) => (
|
{slides.map((slide, i) => (
|
||||||
<div key={i} className="pa-carousel-slide">
|
<div key={i} className="pa-carousel-slide">
|
||||||
<Content {...slide} />
|
<Content blocks={slide.blocks} />
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,95 +8,118 @@ import ProgressBar from './ProgressBar'
|
|||||||
import FancyText from './FancyText'
|
import FancyText from './FancyText'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renderiza un bloque de contenido extraido de Elementor: encabezados,
|
* Renderiza una lista ORDENADA de bloques extraidos de Elementor (ver
|
||||||
* parrafos, imagenes, listas y widgets especiales (acordeon, tabs,
|
* extract_container() en scripts/extract_site.py): encabezados, parrafos,
|
||||||
* carrusel, slideshow, barra de progreso, texto animado).
|
* citas destacadas, imagenes, listas, rejillas de tarjetas, fotos de fondo
|
||||||
|
* a pantalla completa, y los widgets especiales de siempre (acordeon,
|
||||||
|
* tabs, carrusel, slideshow, barra de progreso, texto animado).
|
||||||
|
*
|
||||||
|
* A diferencia de la version anterior (5 arrays planos por tipo), aqui el
|
||||||
|
* orden del array "blocks" ES el orden real del documento original, y cada
|
||||||
|
* bloque trae su propio papel visual -- por eso una rejilla de tarjetas o
|
||||||
|
* una cita destacada ya no se confunden con un parrafo mas.
|
||||||
*
|
*
|
||||||
* Se usa tanto para una seccion completa de la home/paginas legales como,
|
* Se usa tanto para una seccion completa de la home/paginas legales como,
|
||||||
* recursivamente, para el contenido anidado dentro de un panel de
|
* recursivamente, para el contenido anidado dentro de una tarjeta de
|
||||||
* acordeon/tab/slide de carrusel (por eso "truncate" es false por defecto:
|
* rejilla o un panel de acordeon/tab/slide de carrusel.
|
||||||
* los paneles anidados suelen ser pequenos y no conviene recortarlos).
|
|
||||||
*/
|
*/
|
||||||
export default function Content({
|
export default function Content({ blocks = [] }) {
|
||||||
headings = [],
|
|
||||||
paragraphs = [],
|
|
||||||
images = [],
|
|
||||||
lists = [],
|
|
||||||
widgets = [],
|
|
||||||
truncate = false,
|
|
||||||
}) {
|
|
||||||
const shownHeadings = truncate ? headings.slice(0, 2) : headings
|
|
||||||
const shownParagraphs = truncate ? paragraphs.slice(0, 5) : paragraphs
|
|
||||||
const shownImages = truncate ? images.slice(0, 1) : images
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{shownHeadings.map((h, i) => {
|
{blocks.map((block, i) => (
|
||||||
const Tag = (h.level || 'h2').toLowerCase()
|
<Block key={i} block={block} />
|
||||||
return (
|
|
||||||
<Tag
|
|
||||||
key={`h-${i}`}
|
|
||||||
className={`section-heading section-heading--${Tag}`}
|
|
||||||
dangerouslySetInnerHTML={{ __html: sanitizeHtml(h.html) }}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
|
|
||||||
{shownImages.map((img, i) => (
|
|
||||||
<figure key={`img-${i}`} className="section-figure">
|
|
||||||
<img src={img.url} alt={img.alt || ''} loading="lazy" />
|
|
||||||
</figure>
|
|
||||||
))}
|
|
||||||
|
|
||||||
{shownParagraphs.map((p, i) => (
|
|
||||||
<div
|
|
||||||
key={`p-${i}`}
|
|
||||||
className="section-paragraph"
|
|
||||||
dangerouslySetInnerHTML={{ __html: sanitizeHtml(p) }}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
|
|
||||||
{lists.length > 0 && (
|
|
||||||
<div className="section-lists">
|
|
||||||
{lists.map((l, i) => (
|
|
||||||
<ul key={`l-${i}`} className="section-list">
|
|
||||||
{l.map((item, j) => (
|
|
||||||
<li key={j} dangerouslySetInnerHTML={{ __html: sanitizeHtml(item) }} />
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{widgets.map((w, i) => (
|
|
||||||
<Widget key={`w-${i}`} widget={w} />
|
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function Widget({ widget }) {
|
function Block({ block }) {
|
||||||
switch (widget.type) {
|
switch (block.type) {
|
||||||
|
case 'heading': {
|
||||||
|
const Tag = (block.level || 'h2').toLowerCase()
|
||||||
|
return (
|
||||||
|
<Tag
|
||||||
|
className={`section-heading section-heading--${Tag}`}
|
||||||
|
dangerouslySetInnerHTML={{ __html: sanitizeHtml(block.html) }}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'paragraph':
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="section-paragraph"
|
||||||
|
dangerouslySetInnerHTML={{ __html: sanitizeHtml(block.html) }}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
case 'quote':
|
||||||
|
return (
|
||||||
|
<blockquote
|
||||||
|
className="section-quote"
|
||||||
|
dangerouslySetInnerHTML={{ __html: sanitizeHtml(block.html) }}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
case 'image':
|
||||||
|
return (
|
||||||
|
<figure className="section-figure">
|
||||||
|
<img src={block.url} alt={block.alt || ''} loading="lazy" />
|
||||||
|
</figure>
|
||||||
|
)
|
||||||
|
|
||||||
|
case 'banner':
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="section-banner"
|
||||||
|
role="img"
|
||||||
|
aria-label={block.image?.alt || ''}
|
||||||
|
style={{ backgroundImage: block.image?.url ? `url(${encodeURI(block.image.url)})` : undefined }}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
case 'list':
|
||||||
|
return (
|
||||||
|
<ul className="section-list">
|
||||||
|
{block.items.map((item, j) => (
|
||||||
|
<li key={j} dangerouslySetInnerHTML={{ __html: sanitizeHtml(item) }} />
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)
|
||||||
|
|
||||||
|
case 'grid':
|
||||||
|
return (
|
||||||
|
<div className="section-grid">
|
||||||
|
{block.items.map((itemBlocks, j) => (
|
||||||
|
<div className="section-grid-card" key={j}>
|
||||||
|
<Content blocks={itemBlocks} />
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
case 'accordion':
|
case 'accordion':
|
||||||
return <Accordion items={widget.items} />
|
return <Accordion items={block.items} />
|
||||||
case 'tabs':
|
case 'tabs':
|
||||||
return <Tabs items={widget.items} />
|
return <Tabs items={block.items} />
|
||||||
case 'carousel':
|
case 'carousel':
|
||||||
return <Carousel slides={widget.slides} />
|
return <Carousel slides={block.slides} />
|
||||||
case 'slideshow':
|
case 'slideshow':
|
||||||
return <Slideshow slides={widget.slides} />
|
return <Slideshow slides={block.slides} />
|
||||||
case 'progressbar':
|
case 'progressbar':
|
||||||
return <ProgressBar {...widget} />
|
return <ProgressBar {...block} />
|
||||||
case 'fancy-text':
|
case 'fancy-text':
|
||||||
return <FancyText {...widget} />
|
return <FancyText {...block} />
|
||||||
|
|
||||||
case 'carousel-decorative':
|
case 'carousel-decorative':
|
||||||
case 'nav-menu':
|
case 'nav-menu':
|
||||||
// Sin contenido propio que mostrar (ver scripts/extract_site.py).
|
// Sin contenido propio que mostrar (ver scripts/extract_site.py).
|
||||||
return null
|
return null
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (import.meta.env.DEV && widget.type?.startsWith('unhandled:')) {
|
if (import.meta.env.DEV && block.type?.startsWith('unhandled:')) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.warn('[Content] widget sin componente todavia:', widget.type, widget.settingsKeys)
|
console.warn('[Content] bloque sin componente todavia:', block.type, block.settingsKeys)
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default function Tabs({ items = [] }) {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="pa-tabs-panel" role="tabpanel">
|
<div className="pa-tabs-panel" role="tabpanel">
|
||||||
<Content {...items[active]} />
|
<Content blocks={items[active]?.blocks} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
http://remigracion.es/wp-content/uploads/2025/11/question-2.png
|
http://remigracion.es/wp-content/uploads/2025/10/16254777787951-3-scaled-e1761564304440.jpg
|
||||||
|
http://remigracion.es/wp-content/uploads/2025/10/6731734.jpg
|
||||||
|
http://remigracion.es/wp-content/uploads/2025/10/costinvladalamariu_classroom_in_germany_full_of_16_year_old_p_756f463b-99b1-4251-9cff-dd0c3bbe2b4c_2-1456x816-1-e1760630796942.webp
|
||||||
|
http://remigracion.es/wp-content/uploads/2025/10/الهجرة-الى-اوروبا.jpg
|
||||||
http://remigracion.es/wp-content/uploads/2026/02/Imagen2.png
|
http://remigracion.es/wp-content/uploads/2026/02/Imagen2.png
|
||||||
http://remigracion.es/wp-content/uploads/2026/02/Sin-titulo-11.jpg
|
http://remigracion.es/wp-content/uploads/2026/02/Sin-titulo-11.jpg
|
||||||
|
http://remigracion.es/wp-content/uploads/2026/02/Sin-titulo-12.jpg
|
||||||
http://remigracion.es/wp-content/uploads/2026/02/Sin-titulo-15.jpg
|
http://remigracion.es/wp-content/uploads/2026/02/Sin-titulo-15.jpg
|
||||||
http://remigracion.es/wp-content/uploads/2026/02/Sin-titulo-18.jpg
|
http://remigracion.es/wp-content/uploads/2026/02/Sin-titulo-18.jpg
|
||||||
|
http://remigracion.es/wp-content/uploads/2026/02/Sin-titulo-19.jpg
|
||||||
http://remigracion.es/wp-content/uploads/2026/02/Sin-titulo-20.jpg
|
http://remigracion.es/wp-content/uploads/2026/02/Sin-titulo-20.jpg
|
||||||
http://remigracion.es/wp-content/uploads/2026/02/Sin-titulo-22.jpg
|
http://remigracion.es/wp-content/uploads/2026/02/Sin-titulo-22.jpg
|
||||||
http://remigracion.es/wp-content/uploads/2026/02/Sin-titulo-24.jpg
|
http://remigracion.es/wp-content/uploads/2026/02/Sin-titulo-24.jpg
|
||||||
@@ -11,3 +16,7 @@ http://remigracion.es/wp-content/uploads/2026/02/placeholder-10.png
|
|||||||
http://remigracion.es/wp-content/uploads/2026/02/placeholder-11.png
|
http://remigracion.es/wp-content/uploads/2026/02/placeholder-11.png
|
||||||
http://remigracion.es/wp-content/uploads/2026/02/placeholder-8.png
|
http://remigracion.es/wp-content/uploads/2026/02/placeholder-8.png
|
||||||
http://remigracion.es/wp-content/uploads/2026/02/placeholder-9.png
|
http://remigracion.es/wp-content/uploads/2026/02/placeholder-9.png
|
||||||
|
http://remigracion.es/wp-content/uploads/2026/02/zz1.jpg
|
||||||
|
http://remigracion.es/wp-content/uploads/2026/02/zz2-10.jpg
|
||||||
|
http://remigracion.es/wp-content/uploads/2026/02/zz3.jpg
|
||||||
|
http://remigracion.es/wp-content/uploads/2026/02/zz4.jpg
|
||||||
|
|||||||
+445
-210
File diff suppressed because one or more lines are too long
@@ -20,7 +20,7 @@ export default function LegalPage({ pageKey }) {
|
|||||||
return (
|
return (
|
||||||
<section className="section section--default">
|
<section className="section section--default">
|
||||||
<div className="section-inner">
|
<div className="section-inner">
|
||||||
<Content {...page} />
|
<Content blocks={page.blocks} />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user