Add link card blocks to post bodies
A "cards" content block: each item is a card with a picture, title and description that links somewhere, like a link shared in a chat. Fetch preview fills the card from the link. Migration 044 (not deployed yet) now allows both table and cards. Also fixes hidden-field clearing when two fields share a path, and adds table and card blocks to the showcase post. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5dceeb5860
commit
4e9b4e3329
8 changed files with 123 additions and 18 deletions
|
|
@ -149,6 +149,7 @@ export const blocksChild = (ownerKind) => ({
|
|||
"callout",
|
||||
"schedule",
|
||||
"table",
|
||||
"cards",
|
||||
],
|
||||
{ required: true },
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,12 +1,20 @@
|
|||
-- ═══════════════════════════════════════════════════════════════
|
||||
-- 044 TABLE BLOCKS
|
||||
-- 044 TABLE AND CARD BLOCKS
|
||||
--
|
||||
-- A content block of type 'table': a grid of text, for comparison
|
||||
-- charts and the like (a blog post imported from Word, say). The
|
||||
-- grid is the block's text, one row per line, cells split by "|",
|
||||
-- the first row the header; cells take the same inline formatting as
|
||||
-- a paragraph (**bold**, *italic*, [link](url)). ContentBlocks.tsx
|
||||
-- draws it.
|
||||
-- Two content block types:
|
||||
--
|
||||
-- table a grid of text, for comparison charts and the like (a
|
||||
-- blog post imported from Word, say). The grid is the
|
||||
-- block's text, one row per line, cells split by "|", the
|
||||
-- first row the header; cells take the same inline
|
||||
-- formatting as a paragraph (**bold**, *italic*,
|
||||
-- [link](url)).
|
||||
-- cards link cards, one per item, like a link shared in a chat:
|
||||
-- the item's text is the title, detail the description,
|
||||
-- url the link and media the picture (all as today's item
|
||||
-- columns). Fetch preview in the admin fills them.
|
||||
--
|
||||
-- ContentBlocks.tsx draws both.
|
||||
--
|
||||
-- Only the type's CHECK changes, and SQLite can't alter a CHECK, so
|
||||
-- the table is rebuilt the way 031, 032 and 034 did it
|
||||
|
|
@ -25,7 +33,7 @@ CREATE TABLE content_blocks_new (
|
|||
type TEXT NOT NULL
|
||||
CHECK (type IN ('heading', 'subheading', 'paragraph',
|
||||
'list', 'links', 'quote', 'image', 'divider',
|
||||
'video', 'button', 'callout', 'schedule', 'table')),
|
||||
'video', 'button', 'callout', 'schedule', 'table', 'cards')),
|
||||
text TEXT,
|
||||
media TEXT,
|
||||
href TEXT,
|
||||
|
|
|
|||
|
|
@ -132,6 +132,18 @@ const ALL_BLOCKS = [
|
|||
["subheading", { text: "Video" }],
|
||||
["video", { href: "https://www.youtube.com/watch?v=dQw4w9WgXcQ", text: "A YouTube video, with its own thumbnail" }],
|
||||
["video", { href: "https://vimeo.com/76979871", media: IMAGE, text: "A Vimeo video with an uploaded still" }],
|
||||
["subheading", { text: "Table" }],
|
||||
["table", { text: [
|
||||
"Platform | Monthly cost | Best for | Notes",
|
||||
"[Zeffy](https://www.zeffy.com) | Free | Fee-free giving | **0%** to the church",
|
||||
"Breeze | $72 | Small churches | Flat price, all features",
|
||||
"A cell with a bar \\| in it | Blank cells follow | |",
|
||||
].join("\n") }],
|
||||
["subheading", { text: "Link cards" }],
|
||||
["cards", {}, [
|
||||
{ text: "A card with a picture", detail: "Its description, up to three lines, under the title. The whole card is the link.", url: "/retreats", media: IMAGE },
|
||||
{ text: "An outside link, text only", detail: "The card shows the site it goes to above the title.", url: "https://example.org" },
|
||||
]],
|
||||
];
|
||||
|
||||
/* A record page's body: a handful of types, so it reads like a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue