21 lines
738 B
Plaintext
21 lines
738 B
Plaintext
---
|
|
import type { RichTextContent } from "src/shared/payload/payload-sdk";
|
|
import RTNode from "./components/RTNode.astro";
|
|
import RTProse from "./components/RTProse.astro";
|
|
import { type RichTextContext, defaultContext } from "src/utils/richText";
|
|
import ConditionalWrapper from "components/ConditionalWrapper.astro";
|
|
|
|
interface Props {
|
|
content: RichTextContent;
|
|
context?: RichTextContext;
|
|
}
|
|
|
|
const { content, context = defaultContext } = Astro.props;
|
|
---
|
|
|
|
{/* ------------------------------------------- HTML ------------------------------------------- */}
|
|
|
|
<ConditionalWrapper condition={context.depth === 1} wrapper={RTProse}>
|
|
{content.root.children.map((node) => <RTNode node={node} context={context} />)}
|
|
</ConditionalWrapper>
|