b913a2bf90
Refs gitea:Adriano/AI-OS#310 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
49 lines
1.6 KiB
Diff
49 lines
1.6 KiB
Diff
# Review package: b22cc40..b079ded
|
|
|
|
## Commits
|
|
b079ded feat: componenti T e TImg per contenuti taggati
|
|
|
|
## Files changed
|
|
src/components/content/T.astro | 11 +++++++++++
|
|
src/components/content/TImg.astro | 14 ++++++++++++++
|
|
2 files changed, 25 insertions(+)
|
|
|
|
## Diff
|
|
diff --git a/src/components/content/T.astro b/src/components/content/T.astro
|
|
new file mode 100644
|
|
index 0000000..41cefd3
|
|
--- /dev/null
|
|
+++ b/src/components/content/T.astro
|
|
@@ -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>}
|
|
diff --git a/src/components/content/TImg.astro b/src/components/content/TImg.astro
|
|
new file mode 100644
|
|
index 0000000..6c92a75
|
|
--- /dev/null
|
|
+++ b/src/components/content/TImg.astro
|
|
@@ -0,0 +1,14 @@
|
|
+---
|
|
+import { Image } from 'astro:assets';
|
|
+import type { ImageMetadata } from 'astro';
|
|
+import { getImageOverride } from '../../lib/content';
|
|
+interface Props {
|
|
+ tag: string; src: ImageMetadata; alt: string;
|
|
+ class?: string; loading?: 'lazy' | 'eager'; widths?: number[]; sizes?: string;
|
|
+}
|
|
+const { tag, src, alt, class: cls, ...rest } = Astro.props;
|
|
+const override = getImageOverride(tag);
|
|
+---
|
|
+{override
|
|
+ ? <img src={override} alt={alt} class={cls} data-tag={tag} loading={rest.loading} />
|
|
+ : <Image src={src} alt={alt} class={cls} data-tag={tag} {...rest} />}
|