Skip to content

Commit

Permalink
Merge pull request #1174 from prezly/feature/dev-13192-add-support-fo…
Browse files Browse the repository at this point in the history
…r-rendering-coverage-cards-in-sites

[DEV-13192] Add support for coverage cards
  • Loading branch information
kudlajz authored Aug 2, 2024
2 parents a4ca046 + 4a3f835 commit 0aee2d1
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 37 deletions.
12 changes: 11 additions & 1 deletion components/ContentRenderer/ContentRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
VariableNode,
VideoNode,
} from '@prezly/story-content-format';
import { FormattedDate } from '@prezly/theme-kit-nextjs';

import {
Heading,
Expand Down Expand Up @@ -52,11 +53,20 @@ interface Props {
}

export function ContentRenderer({ nodes, story }: Props) {
function renderDate(date: string) {
return <FormattedDate value={date} />;
}

const renderer = (
<div className={styles.renderer}>
<AttachBodyClass className={styles.body} />

<Renderer nodes={nodes} defaultComponents>
<Renderer
nodes={nodes}
defaultComponents
coverageEntries={story?.referenced_entities.coverages}
renderDate={renderDate}
>
<Component match={AttachmentNode.isAttachmentNode} component={Attachment} />
<Component
match={ButtonBlockNode.isButtonBlockNode}
Expand Down
104 changes: 71 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
"@meilisearch/instant-meilisearch": "0.19.0",
"@playwright/test": "^1.33.0",
"@prezly/analytics-nextjs": "3.0.0",
"@prezly/content-renderer-react-js": "0.38.4",
"@prezly/sdk": "21.6.0",
"@prezly/content-renderer-react-js": "0.39.0",
"@prezly/sdk": "21.12.0",
"@prezly/story-content-format": "0.65.1",
"@prezly/theme-kit-nextjs": "9.6.1",
"@prezly/theme-kit-nextjs": "9.7.0",
"@prezly/uploadcare": "2.4.4",
"@prezly/uploadcare-image": "0.3.2",
"@react-hookz/web": "14.7.1",
Expand Down

0 comments on commit 0aee2d1

Please sign in to comment.