@crtobiasdelsud/portal-ui 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crtobiasdelsud/portal-ui",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Componentes compartidos entre el portal (Next) y el CMS (Vite) — widgets, views, providers para adapters y article pool.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -14,6 +14,8 @@ const ampCls = {
14
14
  listOl: "eo-list-ol",
15
15
  quote: "eo-quote",
16
16
  image: "eo-image",
17
+ imageWrap: "eo-image-wrap",
18
+ epigrafe: "eo-image-epigrafe",
17
19
  delimiter: "eo-delimiter",
18
20
  code: "eo-code",
19
21
  pullquote: "eo-pullquote",
@@ -114,23 +116,25 @@ function Block({ block, cls, isAmp }) {
114
116
  )
115
117
 
116
118
  case "image": {
117
- const src = block.data.url || block.data.file?.url
118
- const alt = block.data.altText || block.data.caption || ""
119
- const credit = block.data.authorCredits || block.data.caption
119
+ const src = block.data.url || block.data.file?.url
120
+ const alt = block.data.altText || block.data.caption || ""
121
+ const epigrafe = block.data.epigrafe
120
122
  return (
121
123
  <figure className={cls.image}>
122
- {isAmp
123
- ? <img src={src} alt={alt} />
124
- : <Image
125
- src={src}
126
- alt={alt}
127
- width={0}
128
- height={0}
129
- sizes="(max-width: 768px) 100vw, 800px"
130
- style={{ width: "100%", height: "auto" }}
131
- />
132
- }
133
- {credit && <figcaption>{credit}</figcaption>}
124
+ <div className={cls.imageWrap}>
125
+ {isAmp
126
+ ? <img src={src} alt={alt} />
127
+ : <Image
128
+ src={src}
129
+ alt={alt}
130
+ width={0}
131
+ height={0}
132
+ sizes="(max-width: 768px) 100vw, 800px"
133
+ style={{ width: "100%", height: "auto" }}
134
+ />
135
+ }
136
+ {epigrafe && <p className={cls.epigrafe}>{epigrafe}</p>}
137
+ </div>
134
138
  </figure>
135
139
  )
136
140
  }
@@ -228,13 +232,13 @@ function Block({ block, cls, isAmp }) {
228
232
  const { variant, text, color, align } = block.data
229
233
  const hasClose = variant !== "2"
230
234
  // color === '' → el CSS cae a var(--primary-color, #af0437).
231
- // align ausente (bloques viejos) → default 'center'. Sólo afecta al
232
- // texto; las comillas quedan fijas (apertura izq, cierre der).
235
+ // align ausente (bloques viejos) → default 'center'. `data-align` mueve
236
+ // todo el bloque (comillas + texto); `--pq-text-align` alinea el texto.
233
237
  const pqStyle = { "--pq-text-align": align || "center" }
234
238
  if (color) pqStyle["--eo-pullquote-color"] = color
235
239
  if (isAmp) {
236
240
  return (
237
- <div className={cls.pullquote} style={pqStyle}>
241
+ <div className={cls.pullquote} style={pqStyle} data-align={align || "center"}>
238
242
  <span className={cls.pullquoteOpen}>&ldquo;</span>
239
243
  <p dangerouslySetInnerHTML={{ __html: text }} suppressHydrationWarning />
240
244
  {hasClose && <span className={cls.pullquoteClose}>&rdquo;</span>}
@@ -243,7 +247,7 @@ function Block({ block, cls, isAmp }) {
243
247
  }
244
248
  const pullCls = [cls.pullquote, cls[`pullquoteV${variant}`]].filter(Boolean).join(" ")
245
249
  return (
246
- <div className={pullCls} style={pqStyle}>
250
+ <div className={pullCls} style={pqStyle} data-align={align || "center"}>
247
251
  <span className={cls.pullquoteOpen}>&ldquo;</span>
248
252
  <p dangerouslySetInnerHTML={{ __html: text }} suppressHydrationWarning />
249
253
  {hasClose && <span className={cls.pullquoteClose}>&rdquo;</span>}
@@ -108,13 +108,28 @@
108
108
  height: auto;
109
109
  display: block;
110
110
  }
111
+ }
111
112
 
112
- figcaption {
113
- font-size: 0.8rem;
114
- opacity: 0.6;
115
- margin-top: 0.4rem;
116
- text-align: center;
117
- }
113
+ // Wrapper relativo para anclar el epígrafe sobre la imagen (igual que el hero).
114
+ .imageWrap {
115
+ position: relative;
116
+ display: block;
117
+ }
118
+
119
+ // Epígrafe — franja negra sobre el borde inferior de la foto (estilo ArticleHero).
120
+ .epigrafe {
121
+ position: absolute;
122
+ left: 0;
123
+ right: 0;
124
+ bottom: 0;
125
+ z-index: 1;
126
+ margin: 0;
127
+ padding: 10px 14px;
128
+ font-family: "Inter", "Helvetica", Arial, sans-serif;
129
+ font-size: 0.8rem;
130
+ line-height: 1.35;
131
+ color: #fff;
132
+ background: #000;
118
133
  }
119
134
 
120
135
  .embed {
@@ -214,32 +229,50 @@
214
229
  si no se setea, cae al color del portal: var(--primary-color, #af0437). */
215
230
  .pullquote {
216
231
  --pq-color: var(--eo-pullquote-color, var(--primary-color, #af0437));
217
- margin: 2.25rem 0;
232
+ /* Comillas a los lados del texto (no arriba/abajo): fila flex con la
233
+ comilla de apertura a la izquierda y la de cierre a la derecha. */
234
+ display: flex;
235
+ align-items: stretch;
236
+ gap: 0.75rem;
237
+ max-width: 500px;
238
+ margin: 2.25rem auto;
218
239
  padding: 0.25rem 0;
219
240
  }
220
241
 
242
+ /* La alineación mueve TODO el bloque (comillas + texto) a izq/centro/der. */
243
+ .pullquote[data-align="left"] { margin-inline: 0 auto; }
244
+ .pullquote[data-align="right"] { margin-inline: auto 0; }
245
+ .pullquote[data-align="center"] { margin-inline: auto; }
246
+
221
247
  .pullquoteOpen,
222
248
  .pullquoteClose {
223
- display: block;
249
+ flex: 0 0 auto;
224
250
  font-family: Georgia, "Times New Roman", serif;
225
251
  font-weight: 700;
226
- font-size: 3.75rem;
227
- line-height: 0.1;
252
+ font-size: 6.5rem;
253
+ line-height: 1;
228
254
  color: var(--pq-color);
229
255
  }
230
256
 
231
- /* Comillas fijas: apertura a la izquierda, cierre a la derecha. */
232
- .pullquoteOpen { margin-bottom: 1.5rem; text-align: left; }
233
- .pullquoteClose { margin-top: 1.25rem; text-align: right; }
257
+ /* Apertura pegada arriba; cierre pegado abajo flanqueando el texto.
258
+ line-height 0.1 en el cierre colapsa la caja de línea: así el glifo (que
259
+ se dibuja arriba de su caja) cae hasta el fondo del bloque. */
260
+ .pullquoteOpen { align-self: flex-start; }
261
+ .pullquoteClose { align-self: flex-end; line-height: 0.1; }
234
262
 
235
263
  .pullquote p {
264
+ flex: 1 1 auto;
265
+ /* Permite que el flex item se encoja: sin esto una palabra larga sin
266
+ espacios revienta el max-width del bloque. */
267
+ min-width: 0;
268
+ overflow-wrap: break-word;
269
+ word-break: break-word;
236
270
  margin: 0;
237
271
  font-family: Georgia, "Times New Roman", serif;
238
272
  font-size: 1.6rem;
239
273
  font-weight: 700;
240
274
  line-height: 1.4;
241
275
  color: var(--pq-color);
242
- /* La alineación elegida en el CMS sólo afecta al texto. */
243
276
  text-align: var(--pq-text-align, center);
244
277
  }
245
278
 
@@ -14,6 +14,8 @@ const ampCls = {
14
14
  listOl: "eo-list-ol",
15
15
  quote: "eo-quote",
16
16
  image: "eo-image",
17
+ imageWrap: "eo-image-wrap",
18
+ epigrafe: "eo-image-epigrafe",
17
19
  delimiter: "eo-delimiter",
18
20
  code: "eo-code",
19
21
  pullquote: "eo-pullquote",
@@ -114,23 +116,25 @@ function Block({ block, cls, isAmp }) {
114
116
  )
115
117
 
116
118
  case "image": {
117
- const src = block.data.url || block.data.file?.url
118
- const alt = block.data.altText || block.data.caption || ""
119
- const credit = block.data.authorCredits || block.data.caption
119
+ const src = block.data.url || block.data.file?.url
120
+ const alt = block.data.altText || block.data.caption || ""
121
+ const epigrafe = block.data.epigrafe
120
122
  return (
121
123
  <figure className={cls.image}>
122
- {isAmp
123
- ? <img src={src} alt={alt} />
124
- : <Image
125
- src={src}
126
- alt={alt}
127
- width={0}
128
- height={0}
129
- sizes="(max-width: 768px) 100vw, 800px"
130
- style={{ width: "100%", height: "auto" }}
131
- />
132
- }
133
- {credit && <figcaption>{credit}</figcaption>}
124
+ <div className={cls.imageWrap}>
125
+ {isAmp
126
+ ? <img src={src} alt={alt} />
127
+ : <Image
128
+ src={src}
129
+ alt={alt}
130
+ width={0}
131
+ height={0}
132
+ sizes="(max-width: 768px) 100vw, 800px"
133
+ style={{ width: "100%", height: "auto" }}
134
+ />
135
+ }
136
+ {epigrafe && <p className={cls.epigrafe}>{epigrafe}</p>}
137
+ </div>
134
138
  </figure>
135
139
  )
136
140
  }
@@ -228,13 +232,13 @@ function Block({ block, cls, isAmp }) {
228
232
  const { variant, text, color, align } = block.data
229
233
  const hasClose = variant !== "2"
230
234
  // color === '' → el CSS cae a var(--primary-color, #af0437).
231
- // align ausente (bloques viejos) → default 'center'. Sólo afecta al
232
- // texto; las comillas quedan fijas (apertura izq, cierre der).
235
+ // align ausente (bloques viejos) → default 'center'. `data-align` mueve
236
+ // todo el bloque (comillas + texto); `--pq-text-align` alinea el texto.
233
237
  const pqStyle = { "--pq-text-align": align || "center" }
234
238
  if (color) pqStyle["--eo-pullquote-color"] = color
235
239
  if (isAmp) {
236
240
  return (
237
- <div className={cls.pullquote} style={pqStyle}>
241
+ <div className={cls.pullquote} style={pqStyle} data-align={align || "center"}>
238
242
  <span className={cls.pullquoteOpen}>&ldquo;</span>
239
243
  <p dangerouslySetInnerHTML={{ __html: text }} />
240
244
  {hasClose && <span className={cls.pullquoteClose}>&rdquo;</span>}
@@ -243,7 +247,7 @@ function Block({ block, cls, isAmp }) {
243
247
  }
244
248
  const pullCls = [cls.pullquote, cls[`pullquoteV${variant}`]].filter(Boolean).join(" ")
245
249
  return (
246
- <div className={pullCls} style={pqStyle}>
250
+ <div className={pullCls} style={pqStyle} data-align={align || "center"}>
247
251
  <span className={cls.pullquoteOpen}>&ldquo;</span>
248
252
  <p dangerouslySetInnerHTML={{ __html: text }} />
249
253
  {hasClose && <span className={cls.pullquoteClose}>&rdquo;</span>}
@@ -115,13 +115,28 @@
115
115
  height: auto;
116
116
  display: block;
117
117
  }
118
+ }
118
119
 
119
- figcaption {
120
- font-size: 0.8rem;
121
- opacity: 0.6;
122
- margin-top: 0.4rem;
123
- text-align: center;
124
- }
120
+ // Wrapper relativo para anclar el epígrafe sobre la imagen (igual que el hero).
121
+ .imageWrap {
122
+ position: relative;
123
+ display: block;
124
+ }
125
+
126
+ // Epígrafe — franja negra sobre el borde inferior de la foto (estilo ArticleHero).
127
+ .epigrafe {
128
+ position: absolute;
129
+ left: 0;
130
+ right: 0;
131
+ bottom: 0;
132
+ z-index: 1;
133
+ margin: 0;
134
+ padding: 10px 14px;
135
+ font-family: "Inter", "Helvetica", Arial, sans-serif;
136
+ font-size: 0.8rem;
137
+ line-height: 1.35;
138
+ color: #fff;
139
+ background: #000;
125
140
  }
126
141
 
127
142
  .embed {
@@ -221,32 +236,50 @@
221
236
  si no se setea, cae al color del portal: var(--primary-color, #af0437). */
222
237
  .pullquote {
223
238
  --pq-color: var(--eo-pullquote-color, var(--primary-color, #af0437));
224
- margin: 2.25rem 0;
239
+ /* Comillas a los lados del texto (no arriba/abajo): fila flex con la
240
+ comilla de apertura a la izquierda y la de cierre a la derecha. */
241
+ display: flex;
242
+ align-items: stretch;
243
+ gap: 0.75rem;
244
+ max-width: 500px;
245
+ margin: 2.25rem auto;
225
246
  padding: 0.25rem 0;
226
247
  }
227
248
 
249
+ /* La alineación mueve TODO el bloque (comillas + texto) a izq/centro/der. */
250
+ .pullquote[data-align="left"] { margin-inline: 0 auto; }
251
+ .pullquote[data-align="right"] { margin-inline: auto 0; }
252
+ .pullquote[data-align="center"] { margin-inline: auto; }
253
+
228
254
  .pullquoteOpen,
229
255
  .pullquoteClose {
230
- display: block;
256
+ flex: 0 0 auto;
231
257
  font-family: Georgia, "Times New Roman", serif;
232
258
  font-weight: 700;
233
- font-size: 3.75rem;
234
- line-height: 0.1;
259
+ font-size: 6.5rem;
260
+ line-height: 1;
235
261
  color: var(--pq-color);
236
262
  }
237
263
 
238
- /* Comillas fijas: apertura a la izquierda, cierre a la derecha. */
239
- .pullquoteOpen { margin-bottom: 1.5rem; text-align: left; }
240
- .pullquoteClose { margin-top: 1.25rem; text-align: right; }
264
+ /* Apertura pegada arriba; cierre pegado abajo flanqueando el texto.
265
+ line-height 0.1 en el cierre colapsa la caja de línea: así el glifo (que
266
+ se dibuja arriba de su caja) cae hasta el fondo del bloque. */
267
+ .pullquoteOpen { align-self: flex-start; }
268
+ .pullquoteClose { align-self: flex-end; line-height: 0.1; }
241
269
 
242
270
  .pullquote p {
271
+ flex: 1 1 auto;
272
+ /* Permite que el flex item se encoja: sin esto una palabra larga sin
273
+ espacios revienta el max-width del bloque. */
274
+ min-width: 0;
275
+ overflow-wrap: break-word;
276
+ word-break: break-word;
243
277
  margin: 0;
244
278
  font-family: Georgia, "Times New Roman", serif;
245
279
  font-size: 1.6rem;
246
280
  font-weight: 700;
247
281
  line-height: 1.4;
248
282
  color: var(--pq-color);
249
- /* La alineación elegida en el CMS sólo afecta al texto. */
250
283
  text-align: var(--pq-text-align, center);
251
284
  }
252
285