feat: add hero_image display with Image component

Show actual hero image when available, fallback to code window otherwise.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
Kunthawat GreethongandClaude Opus 4.6 committed 2026-04-30 13:51:52 +07:00
1 parent 6b77cc355e
commit cdf15f8988
1 file changed
+7 -2
+7 -2
View File
@@ -1,6 +1,7 @@
---
import { getEmDashEntry } from "emdash";
import { PortableText } from "emdash/ui";
import { Image } from "emdash/ui";
import Base from "../layouts/Base.astro";
const { entry: homepage } = await getEmDashEntry("homepage", "main");
@@ -36,8 +37,11 @@ const d = homepage.data;
</a>
</div>
</div>
<div class="hero-visual">
<div class="code-window">
<div class="hero-visual" {...homepage.edit.hero_image}>
{d.hero_image?.src ? (
<Image image={d.hero_image} />
) : (
<div class="code-window">
<div class="code-header">
<span class="dot red"></span>
<span class="dot yellow"></span>
@@ -57,6 +61,7 @@ const d = homepage.data;
],
&#125;);</code></pre>
</div>
)}
</div>
</section>