feat: image resizer

This commit is contained in:
Ivan Rezchikov
2026-07-13 19:18:15 +03:00
parent d59b4a79f8
commit 22122aedeb
5 changed files with 61 additions and 19 deletions
+6 -1
View File
@@ -135,6 +135,7 @@ function BlockRenderer({ block }: { block: Block }) {
);
case "IMAGE":
const imageWidth = (b as { width?: number }).width;
return (
<figure className="flex flex-col gap-2">
<img
@@ -142,7 +143,11 @@ function BlockRenderer({ block }: { block: Block }) {
alt={b.caption || "Image"}
width={1200}
height={800}
className="w-full md:w-auto md:max-w-200 h-auto rounded-md border object-contain"
style={imageWidth && imageWidth < 100 ? { width: `${imageWidth}%` } : undefined}
className={cn(
"h-auto rounded-md border object-contain",
imageWidth && imageWidth < 100 ? "" : "w-full md:w-auto md:max-w-200"
)}
/>
{b.caption && (