@reblu/site-blocks 0.11.0 → 0.12.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @reblu/site-blocks
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7a00471: Featured pages per page category (REB-869). `@reblu/site-contracts` adds `PagesListQuery`, the query of `GET /api/site/pages`, including the new `featured` flag. `@reblu/site-client`: `pages.list({ category, featured: true })` returns that category's featured pages (max 3) in the tenant's order, skipping unpublished, deleted or moved pages, and an empty list when nothing is featured; the new `pages.featured(category, { limit?, fallback?, cache? })` helper returns the featured pages, or the category's first `limit` pages in normal order when none are featured, so a landing teaser is never empty. `limit` must be an integer >= 1: above 3 it is clamped to 3; 0, negative, fractional or NaN throw a `RangeError` before any request. Against an API that predates `featured`, the flag is ignored and `pages.featured()` silently degrades to the category's first `limit` pages. `@reblu/site-blocks` adds `PageCardGrid`, the page-card grid `ParentPage` already rendered for its child pages, as a drop-in (`pages`, `pageHref`, `heading`); cards are keyed by category + slug, an empty `heading` renders no `<h2>`. `ParentPage` now renders through it with unchanged markup (including the empty `<h2>` for `childPagesLabel=''`).
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [7a00471]
12
+ - @reblu/site-contracts@1.13.0
13
+
3
14
  ## 0.11.0
4
15
 
5
16
  ### Minor Changes
package/README.md CHANGED
@@ -483,6 +483,30 @@ counterpart are both passed, the new one wins. The default grid heading stays
483
483
  `"Treatments"` and the root keeps `data-slot="specialty"` until that major, so
484
484
  the rename changes no markup — pass `childPagesLabel` to set your own heading.
485
485
 
486
+ ## `PageCardGrid` — featured pages teaser (REB-869)
487
+
488
+ The linked page-card grid `ParentPage` uses for its child pages, as a
489
+ standalone drop-in over any `PageListItem[]`, rendered in the order given (and
490
+ nothing at all for an empty list). Its natural feed is
491
+ `client.pages.featured(category)` from `@reblu/site-client`: the up-to-3 pages
492
+ the tenant featured on that category in nexus («Destacadas en la portada»), in
493
+ the tenant's order — or the category's first pages when none are featured yet.
494
+
495
+ ```tsx
496
+ import { PageCardGrid } from '@reblu/site-blocks'
497
+
498
+ export async function ServicesTeaser() {
499
+ const pages = await client.pages.featured('servicios')
500
+ return (
501
+ <PageCardGrid
502
+ pages={pages}
503
+ heading='Servicios'
504
+ pageHref={(page) => `/${page.category?.slug}/${page.slug}`} // default: `/${slug}`
505
+ />
506
+ )
507
+ }
508
+ ```
509
+
486
510
  ## Page blocks
487
511
 
488
512
  `PageBlocks` renders a page's registry blocks (`PageDetail.blocks` from