- @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]>
28 lines
1.2 KiB
TypeScript
28 lines
1.2 KiB
TypeScript
import type { Field } from 'payload'
|
|
|
|
import { buildLinkField } from '../../../links/buildLinkField.js'
|
|
import { adminText, defineLibraryBlock, variantOption } from '../../define.js'
|
|
import { buildItemsField, buildMediaField } from '../../fields.js'
|
|
|
|
export const LOGOS_VARIANTS = [variantOption('row', 'One row', 'Jeden rząd'), variantOption('grid', 'Grid', 'Siatka')] as const
|
|
|
|
/** Logos — clients, partners or certificates; the name is the alt text when the image has none. */
|
|
export const buildLogosBlock = defineLibraryBlock({
|
|
slug: 'logos',
|
|
fields: ({ maxItems = 24 }) => [
|
|
buildItemsField({
|
|
fields: [
|
|
buildMediaField({ label: adminText('Logo', 'Logo'), required: true }),
|
|
{ name: 'heading', type: 'text', label: adminText('Name', 'Nazwa'), localized: true, required: true },
|
|
buildLinkField({ appearances: false, disableLabel: true }),
|
|
] as Field[],
|
|
labels: { plural: adminText('Logos', 'Logotypy'), singular: adminText('Logo', 'Logo') },
|
|
maxRows: maxItems,
|
|
}),
|
|
],
|
|
interfaceName: 'LogosBlock',
|
|
labels: { plural: adminText('Logos', 'Logotypy'), singular: adminText('Logos', 'Logotypy') },
|
|
links: false,
|
|
variants: LOGOS_VARIANTS,
|
|
})
|