Blog
ProNewA supplied-post blog index with a featured article, category filters and grid, list or masonry cards in plain or image-overlay style, plus an inline or popup post reader.
Installation
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
Props
| Prop | Type | Default |
|---|---|---|
| posts* | BlogPost[] | — |
| layout | "grid" | "list" | "masonry"`grid` wraps equal cards into columns, `list` stacks rows with a thumbnail, `masonry` packs covers of mixed heights. | "grid" |
| variant | "card" | "overlay"`card` puts the text under the cover; `overlay` prints it over the cover on a dark gradient. | "card" |
| featured | booleanShows the first post large, above the rest. | true |
| title | stringHeading above the posts. | — |
| description | string | — |
| categories | booleanShows a filter pill per category. Needs at least two categories. | true |
| aspect | "square" | "landscape" | "portrait"Shape of the covers in the grid and list layouts. | "square" |
| pageSize | numberPosts shown before "Load more". | 6 |
| reader | "popup" | "inline"`popup` opens a post in a dialog; `inline` replaces the list with the post and a back button. | "popup" |
| loading | booleanShows placeholders while you fetch the posts. | — |
| onOpen | (post: BlogPost) => voidCalled when a post is opened in the reader. | — |
| className | string | — |
Accessibility
- Each post is an `article` whose title is the one control; the whole card is clickable but is announced once, by its headline.
- The popup reader is a modal dialog titled by the post: it traps focus, closes on Escape and returns focus to the card that opened it; backdrop and panel enter together.
- The inline reader moves focus to the post's heading, and the back button returns it to the card you came from.
- Category filters are toggle buttons with `aria-pressed`; loading announces "Loading posts" while placeholders show.
- Entrance, cover zoom, the sliding filter pill and the dialog animation are dropped under `prefers-reduced-motion`.