export const ContentRepeater: Block = {
slug: 'contentRepeater',
labels: {
singular: 'Content Repeater',
plural: 'Content Repeater',
},
fields: [
{
name: 'fixedBackgroundImage',
type: 'upload',
label: 'Fixed Background Image',
relationTo: 'media',
required: true,
},
{
name: 'sections',
type: 'array',
minRows: 1,
label: 'Sections',
fields: [
{
label: 'Section Type',
name: 'sectionType',
type: 'select',
required: true,
defaultValue: 'contentContent',
options: [
{
label: 'Content Content',
value: 'contentContent',
},
{
label: 'Content Image',
value: 'contentImage',
},
],
},
{
name: 'imageAlignment',
type: 'select',
label: 'Image Alignment',
required: true,
options: [
{
label: 'Right',
value: 'right',
},
{
label: 'Left',
value: 'left',
},
],
admin: {
condition: (_, siblingData) => siblingData?.sectionType === 'contentImage',
},
},
{
type: 'upload',
name: 'image',
label: 'Image',
relationTo: 'media',
admin: {
condition: (_, siblingData) => siblingData?.sectionType === 'contentImage',
},
},
{
type: 'richText',
name: 'contentOne',
label: 'Content',
},
{
type: 'richText',
name: 'contentTwo',
label: 'Content',
admin: {
condition: (_, siblingData) => siblingData?.sectionType === 'contentContent',
},
},
],
},
],
};