- @intecion/ipal-kit/blocks: libraryBlocks() opt-in, one builder per block, field
builders, option merging, blockLibraryManifest, faqItemsFromLayout
- @intecion/ipal-kit/blocks/rsc: createBlockRegistry, the block components and UI
primitives (token utilities only; next/image and next/link passed in)
- @intecion/ipal-kit/templates: 10 page templates as createSeeder data
- createSeeder: { $form: title } references
- ipal-blocks eject <block>
- tests: options, rendering and a11y per block, Payload + seeding, GraphQL, admin
wording, schema snapshot (versioning), eject imports
- shorter admin labels: link "New tab", table of contents "Show contents"
Co-Authored-By: Claude Opus 5.5 <[email protected]>
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import type { BlockUi } from '../context.js'
|
|
import type { LinksData } from '../data.js'
|
|
|
|
import { cx } from './cx.js'
|
|
|
|
/** The section's buttons in a row; nothing when there are none. */
|
|
export function Buttons({ className, CMSLink, links, locale }: { className?: string; CMSLink: BlockUi['CMSLink']; links?: LinksData; locale: string }) {
|
|
const rows = (links ?? []).filter((row) => row.link)
|
|
if (!rows.length) {return null}
|
|
return (
|
|
<div className={cx('mt-8 flex flex-wrap items-center gap-3', className)}>
|
|
{rows.map((row, i) => (
|
|
<CMSLink key={row.id ?? i} link={row.link} locale={locale} />
|
|
))}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
/** The id of a block's heading (aria-labelledby), when it has one. */
|
|
export function headingId(block: { blockType: string; header?: { heading?: null | string } | null; id?: null | string }): string | undefined {
|
|
return block.header?.heading && block.id ? `${block.blockType}-${block.id}-heading` : undefined
|
|
}
|
|
|
|
/** Grid columns from the `columns` select. */
|
|
export const GRID_COLUMNS: Record<string, string> = {
|
|
four: 'sm:grid-cols-2 lg:grid-cols-4',
|
|
three: 'sm:grid-cols-2 lg:grid-cols-3',
|
|
two: 'sm:grid-cols-2',
|
|
}
|