@crtobiasdelsud/portal-ui 1.0.0 → 1.0.3
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/README.md +21 -21
- package/package.json +1 -1
- package/src/components/Blocks/BlockColumns/BlockColumns.jsx +12 -0
- package/src/components/Blocks/BlockColumns/BlockColumns.module.scss +6 -1
- package/src/components/Blocks/BlockMain/BlockMain.jsx +18 -18
- package/src/components/Cards/ArticleBody/ArticleBody.module.scss +9 -9
- package/src/components/EditorOutput/EditorOutput.jsx +303 -303
- package/src/components/EditorOutput/EditorOutput.module.scss +310 -310
- package/src/components/EditorOutputFull/EditorOutputFull.jsx +303 -303
- package/src/components/EditorOutputFull/EditorOutputFull.module.scss +317 -317
- package/src/components/Hero/Hero.module.scss +7 -0
- package/src/components/Hero/HeroView.jsx +1 -0
- package/src/components/ShareBlock/ShareBlock.module.scss +25 -1
- package/src/components/SpeechPlayerBar/SpeechPlayerBar.jsx +9 -38
- package/src/components/SpeechPlayerBar/SpeechPlayerBar.module.scss +33 -122
- package/src/components/TextWrap/TextWrap.module.scss +72 -72
- package/src/components/UI/Icon/Icon.module.scss +82 -82
- package/src/components/UI/IconSmall/IconSmall.module.scss +82 -82
- package/src/context/SpeechContext.jsx +98 -13
- package/src/index.js +2 -1
- package/src/styles/index.scss +2 -2
- package/src/styles/mixins/_media.scss +29 -29
- package/src/styles/variables/_breakpoint.scss +3 -3
- package/src/styles/variables/_colors.scss +3 -3
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @crtobiasdelsud/portal-ui
|
|
2
2
|
|
|
3
3
|
Librería de componentes compartida entre el portal público (Next 15) y el
|
|
4
4
|
editor CMS (Vite). Provee:
|
|
@@ -35,7 +35,7 @@ editor CMS (Vite). Provee:
|
|
|
35
35
|
## Instalación
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
npm install @
|
|
38
|
+
npm install @crtobiasdelsud/portal-ui
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
`peerDependencies`:
|
|
@@ -47,7 +47,7 @@ npm install @crtobias/portal-ui
|
|
|
47
47
|
|
|
48
48
|
```js
|
|
49
49
|
const nextConfig = {
|
|
50
|
-
transpilePackages: ['@
|
|
50
|
+
transpilePackages: ['@crtobiasdelsud/portal-ui'],
|
|
51
51
|
// ...
|
|
52
52
|
}
|
|
53
53
|
```
|
|
@@ -65,7 +65,7 @@ const nextConfig = {
|
|
|
65
65
|
'use client'
|
|
66
66
|
import Image from 'next/image'
|
|
67
67
|
import Link from 'next/link'
|
|
68
|
-
import { AdaptersProvider } from '@
|
|
68
|
+
import { AdaptersProvider } from '@crtobiasdelsud/portal-ui'
|
|
69
69
|
import { clientFetch } from '@/lib/clientFetch' // tu fetcher con BASE_URL + tenant
|
|
70
70
|
|
|
71
71
|
export default function PortalUIProviders({ children }) {
|
|
@@ -80,7 +80,7 @@ export default function PortalUIProviders({ children }) {
|
|
|
80
80
|
```jsx
|
|
81
81
|
// src/app/layout.jsx (server component)
|
|
82
82
|
import PortalUIProviders from './PortalUIProviders'
|
|
83
|
-
import { SiteConfigProvider } from '@
|
|
83
|
+
import { SiteConfigProvider } from '@crtobiasdelsud/portal-ui'
|
|
84
84
|
|
|
85
85
|
export default async function RootLayout({ children }) {
|
|
86
86
|
const siteData = await fetchSiteConfig() // tu lógica
|
|
@@ -102,7 +102,7 @@ export default async function RootLayout({ children }) {
|
|
|
102
102
|
|
|
103
103
|
```jsx
|
|
104
104
|
// src/PortalUIProviders.jsx
|
|
105
|
-
import { AdaptersProvider } from '@
|
|
105
|
+
import { AdaptersProvider } from '@crtobiasdelsud/portal-ui'
|
|
106
106
|
import ImageShim from './shims/Image' // <img> plano
|
|
107
107
|
import LinkShim from './shims/Link' // <a> plano
|
|
108
108
|
import { backendFetch } from './lib/backendClient'
|
|
@@ -318,10 +318,10 @@ demás (componentes, hooks, styles) es código portable.
|
|
|
318
318
|
En el `package.json` de cada app:
|
|
319
319
|
|
|
320
320
|
```json
|
|
321
|
-
"@
|
|
321
|
+
"@crtobiasdelsud/portal-ui": "file:../portal-ui"
|
|
322
322
|
```
|
|
323
323
|
|
|
324
|
-
`npm install` crea un symlink: `node_modules/@
|
|
324
|
+
`npm install` crea un symlink: `node_modules/@crtobiasdelsud/portal-ui` → `../portal-ui/`. **Cualquier cambio en `portal-ui/src/` aparece al toque** en las apps con HMR. **No tenés que publicar nada.**
|
|
325
325
|
|
|
326
326
|
Cuando hagas un cambio que rompa, ambas apps lo ven en el siguiente reload. Cuando estás contento, lo publicás.
|
|
327
327
|
|
|
@@ -337,20 +337,20 @@ Mismo efecto que `file:`, pero global a tu máquina:
|
|
|
337
337
|
```bash
|
|
338
338
|
cd portal-ui && npm link
|
|
339
339
|
|
|
340
|
-
cd ../editor-template-front && npm link @
|
|
341
|
-
cd ../cms-editor-front && npm link @
|
|
340
|
+
cd ../editor-template-front && npm link @crtobiasdelsud/portal-ui
|
|
341
|
+
cd ../cms-editor-front && npm link @crtobiasdelsud/portal-ui
|
|
342
342
|
```
|
|
343
343
|
|
|
344
344
|
Para desconectar:
|
|
345
345
|
|
|
346
346
|
```bash
|
|
347
|
-
cd editor-template-front && npm unlink @
|
|
347
|
+
cd editor-template-front && npm unlink @crtobiasdelsud/portal-ui && npm install
|
|
348
348
|
```
|
|
349
349
|
|
|
350
350
|
#### C. Versión publicada (producción / otro dev sin acceso al disco)
|
|
351
351
|
|
|
352
352
|
```json
|
|
353
|
-
"@
|
|
353
|
+
"@crtobiasdelsud/portal-ui": "^1.0.0"
|
|
354
354
|
```
|
|
355
355
|
|
|
356
356
|
```bash
|
|
@@ -465,7 +465,7 @@ export default function NewsletterView({ subscribers, onSubmit }) {
|
|
|
465
465
|
```jsx
|
|
466
466
|
// editor-template-front/src/components/Newsletter/Newsletter.jsx (data layer)
|
|
467
467
|
import { backendFetch } from '@/lib/backendClient'
|
|
468
|
-
import { NewsletterView } from '@
|
|
468
|
+
import { NewsletterView } from '@crtobiasdelsud/portal-ui'
|
|
469
469
|
|
|
470
470
|
export default async function Newsletter({ settings }) {
|
|
471
471
|
const subs = await fetchSubscribers(backendFetch)
|
|
@@ -477,7 +477,7 @@ export default async function Newsletter({ settings }) {
|
|
|
477
477
|
// cms-editor-front/src/previewHome/components/Newsletter/Newsletter.jsx (data layer)
|
|
478
478
|
import { useEffect, useState } from 'react'
|
|
479
479
|
import { backendFetch } from '@/lib/backendClient'
|
|
480
|
-
import { NewsletterView } from '@
|
|
480
|
+
import { NewsletterView } from '@crtobiasdelsud/portal-ui'
|
|
481
481
|
|
|
482
482
|
export default function Newsletter({ settings }) {
|
|
483
483
|
const [subs, setSubs] = useState([])
|
|
@@ -506,7 +506,7 @@ path con un re-export:
|
|
|
506
506
|
```jsx
|
|
507
507
|
// editor-template-front/src/components/Newsletter/Newsletter.jsx
|
|
508
508
|
'use client'
|
|
509
|
-
export { Newsletter as default } from '@
|
|
509
|
+
export { Newsletter as default } from '@crtobiasdelsud/portal-ui'
|
|
510
510
|
```
|
|
511
511
|
|
|
512
512
|
Así no hay que tocar 20 callers — el caller sigue importando como antes, pero
|
|
@@ -535,8 +535,8 @@ git push --follow-tags
|
|
|
535
535
|
### 8. En las apps, traer la versión nueva
|
|
536
536
|
|
|
537
537
|
```bash
|
|
538
|
-
cd ~/Desktop/editor-template-front && npm install @
|
|
539
|
-
cd ~/Desktop/cms-editor-front && npm install @
|
|
538
|
+
cd ~/Desktop/editor-template-front && npm install @crtobiasdelsud/portal-ui@latest
|
|
539
|
+
cd ~/Desktop/cms-editor-front && npm install @crtobiasdelsud/portal-ui@latest
|
|
540
540
|
```
|
|
541
541
|
|
|
542
542
|
---
|
|
@@ -598,8 +598,8 @@ git clone git@github.com:crtobias/cms-editor-front.git
|
|
|
598
598
|
|
|
599
599
|
# Asegurarse que las apps usen el paquete local
|
|
600
600
|
cd portal-ui && npm link
|
|
601
|
-
cd ../editor-template-front && npm link @
|
|
602
|
-
cd ../cms-editor-front && npm link @
|
|
601
|
+
cd ../editor-template-front && npm link @crtobiasdelsud/portal-ui
|
|
602
|
+
cd ../cms-editor-front && npm link @crtobiasdelsud/portal-ui
|
|
603
603
|
```
|
|
604
604
|
|
|
605
605
|
**Para cada cambio:**
|
|
@@ -813,7 +813,7 @@ import {
|
|
|
813
813
|
FeedView, HeroView, RecommendedView, CabezalView,
|
|
814
814
|
BannerView, BannerDisplay, ClimaView,
|
|
815
815
|
TextWrapView, ArticleBodyView,
|
|
816
|
-
} from '@
|
|
816
|
+
} from '@crtobiasdelsud/portal-ui'
|
|
817
817
|
```
|
|
818
818
|
|
|
819
819
|
---
|
|
@@ -826,4 +826,4 @@ import {
|
|
|
826
826
|
cambio de shape, cambio de signature de hook)
|
|
827
827
|
|
|
828
828
|
Pinear con `^` para auto-update minor/patch en las apps. Para producción
|
|
829
|
-
estable, pinear exact (`"@
|
|
829
|
+
estable, pinear exact (`"@crtobiasdelsud/portal-ui": "1.1.2"`).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crtobiasdelsud/portal-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
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,11 @@ export default function BlockColumns({ widgets, registry, settings = {} }) {
|
|
|
14
14
|
? style.gridCategoriaDos
|
|
15
15
|
: hasImportant ? style.gridFeatured : style.gridNormal
|
|
16
16
|
|
|
17
|
+
// Hero "fantasma": cuando hay un hero importante se agrega un Hero extra,
|
|
18
|
+
// sin articleId (artículo random), solo para ocupar el espacio del centro
|
|
19
|
+
// de la fila de abajo.
|
|
20
|
+
const HeroWidget = registry["HERO_BLOCK"]
|
|
21
|
+
|
|
17
22
|
return (
|
|
18
23
|
<section className={style.container}>
|
|
19
24
|
<div className={`${style.grid} ${gridClass}`}>
|
|
@@ -31,6 +36,13 @@ export default function BlockColumns({ widgets, registry, settings = {} }) {
|
|
|
31
36
|
</div>
|
|
32
37
|
)
|
|
33
38
|
})}
|
|
39
|
+
{hasImportant && HeroWidget && (
|
|
40
|
+
<div className={style.item} style={{ gridArea: "fantasma" }}>
|
|
41
|
+
<WidgetErrorBoundary>
|
|
42
|
+
<HeroWidget settings={{}} />
|
|
43
|
+
</WidgetErrorBoundary>
|
|
44
|
+
</div>
|
|
45
|
+
)}
|
|
34
46
|
</div>
|
|
35
47
|
</section>
|
|
36
48
|
)
|
|
@@ -26,15 +26,20 @@
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/* Hero "importante": hero grande arriba a todo el ancho; abajo
|
|
30
|
+
widget1 + hero fantasma (automático) + widget2. */
|
|
29
31
|
.gridFeatured {
|
|
30
32
|
grid-template-areas:
|
|
31
33
|
"hero"
|
|
32
34
|
"recommended"
|
|
35
|
+
"fantasma"
|
|
33
36
|
"feed";
|
|
34
37
|
|
|
35
38
|
@media (min-width: 1000px) {
|
|
36
39
|
grid-template-columns: repeat(4, 1fr);
|
|
37
|
-
grid-template-areas:
|
|
40
|
+
grid-template-areas:
|
|
41
|
+
"hero hero hero hero"
|
|
42
|
+
"recommended fantasma fantasma feed";
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
45
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import style from "./BlockMain.module.scss"
|
|
2
|
-
import WidgetErrorBoundary from "../WidgetErrorBoundary"
|
|
3
|
-
|
|
4
|
-
export default function BlockMain({ widgets, registry }) {
|
|
5
|
-
const widget = widgets?.[0]
|
|
6
|
-
if (!widget) return null
|
|
7
|
-
|
|
8
|
-
const Widget = registry[widget.type]
|
|
9
|
-
if (!Widget) return null
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<section className={style.container}>
|
|
13
|
-
<WidgetErrorBoundary>
|
|
14
|
-
<Widget settings={widget.settings} />
|
|
15
|
-
</WidgetErrorBoundary>
|
|
16
|
-
</section>
|
|
17
|
-
)
|
|
18
|
-
}
|
|
1
|
+
import style from "./BlockMain.module.scss"
|
|
2
|
+
import WidgetErrorBoundary from "../WidgetErrorBoundary"
|
|
3
|
+
|
|
4
|
+
export default function BlockMain({ widgets, registry }) {
|
|
5
|
+
const widget = widgets?.[0]
|
|
6
|
+
if (!widget) return null
|
|
7
|
+
|
|
8
|
+
const Widget = registry[widget.type]
|
|
9
|
+
if (!Widget) return null
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<section className={style.container}>
|
|
13
|
+
<WidgetErrorBoundary>
|
|
14
|
+
<Widget settings={widget.settings} />
|
|
15
|
+
</WidgetErrorBoundary>
|
|
16
|
+
</section>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
.container {
|
|
4
|
-
border: 10px solid red;
|
|
5
|
-
background-color: var(--surface-color, #ffffff);
|
|
6
|
-
box-sizing: border-box;
|
|
7
|
-
height: 100%;
|
|
8
|
-
max-width: 1520px;
|
|
9
|
-
}
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
.container {
|
|
4
|
+
border: 10px solid red;
|
|
5
|
+
background-color: var(--surface-color, #ffffff);
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
height: 100%;
|
|
8
|
+
max-width: 1520px;
|
|
9
|
+
}
|