30 lines
556 B
Text
30 lines
556 B
Text
|
---
|
||
|
import type { AstroNode } from './astroNode';
|
||
|
|
||
|
type Props = {
|
||
|
node: AstroNode;
|
||
|
};
|
||
|
|
||
|
const Node = (Astro.props as Props).node;
|
||
|
---
|
||
|
|
||
|
{
|
||
|
typeof Node === 'string' ? (
|
||
|
<Fragment set:text={Node} />
|
||
|
) : 'component' in Node ? (
|
||
|
<Node.component {...Node.props}>
|
||
|
{Node.children.map((child) => (
|
||
|
<Astro.self node={child} />
|
||
|
))}
|
||
|
</Node.component>
|
||
|
) : (
|
||
|
<Fragment>
|
||
|
<Fragment set:html={`<${Node.tag}>`} />
|
||
|
{Node.children.map((child) => (
|
||
|
<Astro.self node={child} />
|
||
|
))}
|
||
|
<Fragment set:html={`</${Node.tag}>`} />
|
||
|
</Fragment>
|
||
|
)
|
||
|
}
|