Files
blog-service/frontend/src/components/blocks/ImageBlock.tsx
T

30 lines
623 B
TypeScript
Raw Normal View History

2026-08-22 17:57:54 -05:00
import { getString } from "./BlockHelpers";
export default function ImageBlock({
content,
}: {
content: Record<string, unknown>;
}) {
const src = getString(content, "src");
const alt = getString(content, "alt");
const caption = getString(content, "caption");
if (!src) return null;
return (
<figure className="my-10">
<img
src={src}
alt={alt}
className="h-auto w-full border-2 border-dark object-cover"
/>
{caption && (
<figcaption className="mt-2 text-center text-sm text-tn1">
{caption}
</figcaption>
)}
</figure>
);
}