prismicio / prismic-react

React components and hooks to fetch and present Prismic content
https://prismic.io/docs/technologies/homepage-reactjs
Apache License 2.0
154 stars 40 forks source link

feat: support Prismic's GraphQL API in `<SliceZone>` #141

Closed angeloashmore closed 2 years ago

angeloashmore commented 2 years ago

Types of changes

Description

This PR adds support for Prismic's GraphQL API when using <SliceZone>.

The GraphQL API returns Slices with the following shape:

{
  "type": "foo",
  "label": "bar",
  "primary": {},
  "items": []
}

The Rest API returns Slices with the following shape:

{
  "slice_type": "foo",
  "slice_label": "bar",
  "primary": {},
  "items": []
}

To support the GraphQL API, <SliceZone> can now read a Slice's slice_type or type property to determine which component to render.

Checklist:

🐙

github-actions[bot] commented 2 years ago

size-limit report 📦

Path Size
dist/index.js 4.43 KB (+0.31% 🔺)
dist/index.cjs 6.31 KB (+0.21% 🔺)