- @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]>
27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
import { adminText, defineLibraryBlock, variantOption } from '../../define.js'
|
|
import { buildItemsField, buildMediaField } from '../../fields.js'
|
|
import { columnsField } from '../../shared.js'
|
|
|
|
export const GALLERY_VARIANTS = [variantOption('grid', 'Even grid', 'Równa siatka'), variantOption('masonry', 'Mosaic', 'Mozaika')] as const
|
|
|
|
/** Gallery — images that open enlarged in the site's image viewer. */
|
|
export const buildGalleryBlock = defineLibraryBlock({
|
|
slug: 'gallery',
|
|
fields: ({ maxItems = 48 }) => [
|
|
buildItemsField({
|
|
fields: [
|
|
buildMediaField({ required: true }),
|
|
{ name: 'caption', type: 'text', label: adminText('Caption', 'Podpis'), localized: true },
|
|
],
|
|
labels: { plural: adminText('Images', 'Obrazy'), singular: adminText('Image', 'Obraz') },
|
|
maxRows: maxItems,
|
|
rowLabelField: ['caption', 'media.alt', 'media.filename'],
|
|
}),
|
|
columnsField(),
|
|
],
|
|
interfaceName: 'GalleryBlock',
|
|
labels: { plural: adminText('Galleries', 'Galerie'), singular: adminText('Gallery', 'Galeria') },
|
|
links: { maxRows: 1 },
|
|
variants: GALLERY_VARIANTS,
|
|
})
|