Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@
Previously, every handler had to be typed by hand to mirror the generated query shape:

```tsx
import {PortableText} from '@portabletext/react'
// app/[slug]/page.tsx
import {createClient} from '@sanity/client'
import {createImageUrlBuilder} from '@sanity/image-url'
import {PortableText} from '@portabletext/react'
import {defineQuery} from 'groq'

const client = createClient({
Expand Down Expand Up @@ -226,10 +226,10 @@
Now the same handler is fully typed straight from `data.content`:

```tsx
import {PortableText} from '@portabletext/react'
// app/[slug]/page.tsx
import {createClient} from '@sanity/client'
import {createImageUrlBuilder} from '@sanity/image-url'
import {PortableText} from '@portabletext/react'
import {defineQuery} from 'groq'

const client = createClient({
Expand Down Expand Up @@ -268,10 +268,10 @@
Move the `components` map out of JSX and keep the same inferred handler types:

```tsx
import {PortableText, type InferComponents} from '@portabletext/react'
// app/[slug]/page.tsx
import {createClient} from '@sanity/client'
import {createImageUrlBuilder} from '@sanity/image-url'
import {PortableText, type InferComponents} from '@portabletext/react'
import {defineQuery} from 'groq'

const client = createClient({
Expand Down Expand Up @@ -308,10 +308,10 @@
`InferValue<SanityQueries[keyof SanityQueries]>` collects every Portable Text item shape from every registered TypeGen query into an array value type, and `InferStrictComponents` requires a handler for each of them. Together they're perfect for a single `CustomPortableText` you reuse across the app:

```tsx
import {PortableText, type InferStrictComponents, type InferValue} from '@portabletext/react'
// app/[slug]/page.tsx
import {createClient, type SanityQueries} from '@sanity/client'
import {createImageUrlBuilder} from '@sanity/image-url'
import {PortableText, type InferStrictComponents, type InferValue} from '@portabletext/react'
import {defineQuery} from 'groq'

const client = createClient({
Expand Down
2 changes: 1 addition & 1 deletion MIGRATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ We've removed the only Sanity-specific part of the module, which was image handl
We've seen the community have vastly different preferences on how images should be rendered, so having a generic image component included out of the box felt unnecessary.

```jsx
import urlBuilder from '@sanity/image-url'
import {getImageDimensions} from '@sanity/asset-utils'
import urlBuilder from '@sanity/image-url'

// Barebones lazy-loaded image component
const SampleImageComponent = ({value}) => {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ Example of rendering a custom `image` object:

```jsx
import {PortableText} from '@portabletext/react'
import urlBuilder from '@sanity/image-url'
import {getImageDimensions} from '@sanity/asset-utils'
import urlBuilder from '@sanity/image-url'

// Barebones lazy-loaded image component
const SampleImageComponent = ({value, isInline}) => {
Expand Down
Loading