diff --git a/CHANGELOG.md b/CHANGELOG.md index a3a40a7..26ede80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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({ @@ -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({ @@ -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({ @@ -308,10 +308,10 @@ `InferValue` 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({ diff --git a/MIGRATING.md b/MIGRATING.md index 524ce1c..4d9de93 100644 --- a/MIGRATING.md +++ b/MIGRATING.md @@ -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}) => { diff --git a/README.md b/README.md index 310d9df..f444639 100644 --- a/README.md +++ b/README.md @@ -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}) => {