feat: componenti T e TImg per contenuti taggati
This commit is contained in:
@@ -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>}
|
||||
Reference in New Issue
Block a user