Files
payload/test/live-preview/blocks/Content/index.ts
2023-10-06 12:32:13 -04:00

59 lines
1.0 KiB
TypeScript

import type { Block, Field } from '../../../../packages/payload/src/fields/config/types'
import { invertBackground } from '../../fields/invertBackground'
import link from '../../fields/link'
const columnFields: Field[] = [
{
name: 'size',
type: 'select',
defaultValue: 'oneThird',
options: [
{
value: 'oneThird',
label: 'One Third',
},
{
value: 'half',
label: 'Half',
},
{
value: 'twoThirds',
label: 'Two Thirds',
},
{
value: 'full',
label: 'Full',
},
],
},
{
name: 'richText',
label: 'Rich Text',
type: 'richText',
},
{
name: 'enableLink',
type: 'checkbox',
},
link({
overrides: {
admin: {
condition: (_, { enableLink }) => Boolean(enableLink),
},
},
}),
]
export const Content: Block = {
slug: 'content',
fields: [
invertBackground,
{
name: 'columns',
type: 'array',
fields: columnFields,
},
],
}