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

Add `<PrismicImage>` #124

Closed angeloashmore closed 2 years ago

angeloashmore commented 2 years ago

Is your feature request related to a problem? Please describe.

@prismicio/react does not currently provide a helper for rendering Image fields. A simple image component could be provided as a wrapper around @prismicio/helpers's Image field helpers.

Note: Even after implementing such a component, framework-specific image integrations should be preferred over this component. Framework-specific integrations can generally offer a better experience, such as base64 image placeholders.

For example, use Next.js's next/image component or Gatsby's gatsby-plugin-image component if you are using those frameworks. Only use @prismicio/react's image component if your environment does not have a built-in optimized image component.

Describe the solution you'd like

See #140

Describe alternatives you've considered

@prismicio/helpers's Image field helpers can be used directly.

Additional context

This component should be modeled after @prismicio/vue's <PrismicImage> component.

angeloashmore commented 2 years ago

This is being implemented in #140.

angeloashmore commented 2 years ago

Merged in #140 and will be published along with the next set of features + fixes.