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:
parent
c26e662406
commit
a0eb9d7e49
7 changed files with 39 additions and 2 deletions
|
|
@ -183,6 +183,7 @@ also in `server/src/admin-schema/` and a CHECK):
|
|||
| Content blocks → Shown in (slot) | card, body | **yes** | `paragraphs()` in `server/src/shape.js` (card), `ContentBlocks.tsx` (body) |
|
||||
| Content blocks → Type | heading, subheading, paragraph, list, links, quote, image, divider, video, button, callout, schedule, table, cards, people, map, events, organizations | **yes**, `BLOCK_TYPES` (with each type's description) | `ContentBlocks.tsx` (one renderer per type). Which fields each type shows is `when` on the fields in `blocksChild` (`src/lib/adminSchema/shared.ts`). |
|
||||
| Content blocks → Schedule items → Type | (blank: normal entry), block, break, heading | **yes**, migration 086 | `SCHEDULE_KINDS` in `src/lib/adminSchema/shared.ts`; drawn by `ScheduleBlock.tsx` and `EventPresent.tsx` (which slides each kind gets; the presentation cuts the event's page into sections at its Heading blocks). A block's sub-items are `content_block_subitems`. A schedule's own tags (087) are `content_block_tags`, rows of the block typed in the admin (not a fixed list); entries name them by `tag_key`, made in the admin as the tag is added. A schedule's Venue (088) lends its locations (Data → Venues, `venue_locations`) to its entries' Map location, named by `location_key` the same way; an entry's Event (a workshop) fills what it leaves blank in `shape.js` (`attachEvents`). |
|
||||
| Content blocks → Image → Size | (blank: the column's full width), small (20rem), medium (32rem), large (48rem) | **yes**, migration 101 | The `image_size` field in `src/lib/adminSchema/shared.ts`; `IMAGE_SIZE` in `ContentBlocks.tsx` sets the widths |
|
||||
| Content blocks → List → Style | (blank: bold text, normal detail), plain (plain text, gray detail) | **yes**, migration 092 | The Style field in `src/lib/adminSchema/shared.ts`; drawn by the `list` case in `ContentBlocks.tsx`. |
|
||||
| Content blocks (an event's) → Shown | (blank: the page and the presentation), page, presentation | **yes**, migration 099 | `PRESENT_BLOCK_FIELDS` in `src/lib/adminSchema/shared.ts`; `ContentBlocks.tsx` leaves out a presentation-only block on the page and a page-only one presented, `sectionsOf` in `src/pages/EventPresent.tsx` too |
|
||||
| Content blocks (an event's) → Map → Location slides | (blank: each marked location), picked (the Locations with a slide), none | **yes**, migration 095 | `PRESENT_BLOCK_FIELDS` in `src/lib/adminSchema/shared.ts`; read by `mapSlides` in `src/pages/EventPresent.tsx` |
|
||||
|
|
|
|||
|
|
@ -179,6 +179,8 @@ export const blocksChild = (ownerKind) => ({
|
|||
text("venue_id"),
|
||||
// List blocks (092): null bold text, 'plain' the old look.
|
||||
enumeration("list_style", ["plain"]),
|
||||
// Image blocks (101): null full width, else a narrower size.
|
||||
enumeration("image_size", ["small", "medium", "large"]),
|
||||
// Organizations blocks (093): the kind listed when none are picked.
|
||||
enumeration("org_kind", ["region", "group", "partner", "ministry"]),
|
||||
// How it's presented (095): EventPresent.tsx.
|
||||
|
|
|
|||
15
server/src/migrations/101_image_size.sql
Normal file
15
server/src/migrations/101_image_size.sql
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
-- ═══════════════════════════════════════════════════════════════
|
||||
-- 101 AN IMAGE BLOCK'S SIZE
|
||||
--
|
||||
-- How wide an image block shows, centered in the column:
|
||||
--
|
||||
-- null the column's full width (as before)
|
||||
-- small up to 20rem
|
||||
-- medium up to 32rem
|
||||
-- large up to 48rem
|
||||
--
|
||||
-- Never wider than the column. Other block types ignore it.
|
||||
-- ═══════════════════════════════════════════════════════════════
|
||||
|
||||
ALTER TABLE content_blocks ADD COLUMN image_size TEXT
|
||||
CHECK (image_size IN ('small', 'medium', 'large'));
|
||||
|
|
@ -87,7 +87,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body", depth = 0) {
|
|||
const blockRows = db
|
||||
.prepare(
|
||||
`SELECT id, owner_id, type, text, media, href, alt, cite, captions, team_id, venue_id,
|
||||
word_motion, word_direction, word_seconds, list_style, org_kind,
|
||||
word_motion, word_direction, word_seconds, list_style, image_size, org_kind,
|
||||
present_show, present_text, present_map_split, present_map_no_list,
|
||||
present_map_no_details, present_places, present_place_keys
|
||||
FROM content_blocks
|
||||
|
|
@ -112,6 +112,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body", depth = 0) {
|
|||
team_id: row.team_id,
|
||||
venue_id: row.venue_id,
|
||||
list_style: row.list_style,
|
||||
image_size: row.image_size,
|
||||
org_kind: row.org_kind,
|
||||
// Its rotating words' motion (084), when it has its own.
|
||||
words: row.word_motion || row.word_direction || row.word_seconds
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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). */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue