33 lines
760 B
TypeScript
33 lines
760 B
TypeScript
import { rteType } from "@/types/rte";
|
|
|
|
import Image from "next/image";
|
|
|
|
import type { TextProps } from "@/types/components/current/blocks/text"
|
|
|
|
export default function Text({ text }: TextProps) {
|
|
|
|
return (
|
|
<>
|
|
<pre>{JSON.stringify(text.content.json, null, 2)}</pre>
|
|
{text.content.json.children.map(block => {
|
|
switch (block.type) {
|
|
case rteType.reference: {
|
|
if (block.attrs.type === rteType.asset) {
|
|
// return (
|
|
// <Image
|
|
// alt={block.attrs.alt}
|
|
// src={block.attrs["asset-link"]}
|
|
// />
|
|
// )
|
|
}
|
|
|
|
return null
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
})}
|
|
</>
|
|
)
|
|
}
|