Image block: a Size (small, medium, large), centered

- image_size (101): blank the column's full width, else up to 20, 32
  or 48rem, centered and never wider than the column

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-11-12 05:58:49 -06:00
parent c26e662406
commit a0eb9d7e49
7 changed files with 39 additions and 2 deletions

View file

@ -76,6 +76,9 @@ import { usePresenting } from '../lib/presenting.ts'
const BODY = 'var(--color-muted)'
/* An image block's Size (101): its widest, centered. */
const IMAGE_SIZE = { small: 'max-w-[20rem]', medium: 'max-w-[32rem]', large: 'max-w-[48rem]' } as const
export default function ContentBlocks({
blocks,
accent = BRAND,
@ -579,7 +582,7 @@ function Block({
/>
)
return (
<figure>
<figure className={block.image_size ? `mx-auto ${IMAGE_SIZE[block.image_size]}` : undefined}>
{block.href ? <Anchor href={block.href}>{img}</Anchor> : img}
<Caption text={text} />
</figure>

View file

@ -659,6 +659,19 @@ export const blocksChild = {
when: { path: "type", value: "video" },
help: "A WebVTT (.vtt) file, for an uploaded video; YouTube, Vimeo and Facebook show their own. Default: none.",
},
{
path: "image_size",
label: "Size",
widget: "select",
options: [
["small", "Small (up to 20rem)"],
["medium", "Medium (up to 32rem)"],
["large", "Large (up to 48rem)"],
],
blankLabel: "Default: the column's full width",
help: "A smaller one is centered. Never wider than the column.",
when: { path: "type", value: "image" },
},
{
path: "alt",
label: "Alt text",

View file

@ -57,6 +57,8 @@ export type ContentBlock = {
cite?: string | null
/** A list block's style (092): null bold text, 'plain' the old look. */
list_style?: 'plain' | null
/** An image block's size (101): null the column's width. */
image_size?: 'small' | 'medium' | 'large' | null
/** An organizations block's kind, listed when none are picked (093). */
org_kind?: 'region' | 'group' | 'partner' | 'ministry' | null
/** A video block's WebVTT file, for an uploaded video (066). */