import { PortableText as SanityPortableText } from "@portabletext/react"; import Image from "next/image"; import { urlFor } from "@/lib/sanity"; import type { PortableTextBlock } from "@portabletext/types"; interface PortableTextProps { content: PortableTextBlock[]; } const components = { types: { image: ({ value }: any) => { if (!value?.asset) return null; const imageUrl = urlFor(value); const asset = value.asset; // Get natural dimensions if available from metadata const dimensions = asset.metadata?.dimensions; const width = dimensions?.width || 1000; const height = dimensions?.height || 562; const aspectRatio = dimensions ? height / width : 0.5625; // Default to 16:9 if no dimensions return (
{value.alt}
)}{props.children}
), blockquote: (props: any) => ({props.children}), }, list: { bullet: (props: any) => (