- @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]>
35 lines
1.6 KiB
TypeScript
35 lines
1.6 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 TEAM_VARIANTS = [variantOption('grid', 'Grid', 'Siatka'), variantOption('list', 'List', 'Lista')] as const
|
|
|
|
/** Team — people with a photo, name, role and a profile link. */
|
|
export const buildTeamBlock = defineLibraryBlock({
|
|
slug: 'team',
|
|
fields: ({ maxItems = 24 }) => [
|
|
buildItemsField({
|
|
fields: [
|
|
buildMediaField({ label: adminText('Photo', 'Zdjęcie') }),
|
|
{
|
|
type: 'row',
|
|
fields: [
|
|
{ name: 'heading', type: 'text', admin: { width: '50%' }, label: adminText('Name', 'Imię i nazwisko'), localized: true, required: true },
|
|
{ name: 'text', type: 'text', admin: { placeholder: adminText('Co-founder', 'Współzałożycielka'), width: '50%' }, label: adminText('Role', 'Stanowisko'), localized: true },
|
|
],
|
|
},
|
|
{ name: 'bio', type: 'textarea', admin: { rows: 3 }, label: adminText('Short bio', 'Krótki opis'), localized: true },
|
|
buildLinkField({ name: 'link', appearances: false }),
|
|
] as Field[],
|
|
labels: { plural: adminText('People', 'Osoby'), singular: adminText('Person', 'Osoba') },
|
|
maxRows: maxItems,
|
|
}),
|
|
],
|
|
interfaceName: 'TeamBlock',
|
|
labels: { plural: adminText('Teams', 'Zespoły'), singular: adminText('Team', 'Zespół') },
|
|
links: { maxRows: 1 },
|
|
variants: TEAM_VARIANTS,
|
|
})
|