feat: componenti T e TImg per contenuti taggati

This commit is contained in:
2026-07-05 15:46:11 +02:00
parent b22cc40b03
commit b079ded266
2 changed files with 25 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
---
import { resolveContent } from '../../lib/content';
interface Props { tag: string; as?: string; class?: string }
const { tag, as = 'span', class: cls } = Astro.props;
const Tag = as;
const c = resolveContent(tag);
const classes = [cls, c.classes].filter(Boolean).join(' ') || undefined;
---
{c.type === 'html'
? <Tag data-tag={tag} class={classes} set:html={c.value} />
: <Tag data-tag={tag} class={classes}>{c.value}</Tag>}