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
{value.alt && (

{value.alt}

)}
); }, }, block: { h1: (props: any) => (

{props.children}

), h2: (props: any) => (

{props.children}

), h3: (props: any) => (

{props.children}

), h4: (props: any) => (

{props.children}

), normal: (props: any) => (

{props.children}

), blockquote: (props: any) => (
{props.children}
), }, list: { bullet: (props: any) => ( ), number: (props: any) => (
    {props.children}
), }, listItem: { bullet: (props: any) =>
  • {props.children}
  • , number: (props: any) =>
  • {props.children}
  • , }, marks: { strong: ({ children }: { children: React.ReactNode }) => ( {children} ), em: ({ children }: { children: React.ReactNode }) => ( {children} ), link: (props: any) => ( {props.children} ), }, }; export function PortableText({ content }: PortableTextProps) { return ; }