wwwfiberdirekt/src/blocks/FDUspChecklistBlock/config.ts

105 lines
2.6 KiB
TypeScript

import type { Block } from 'payload'
import { anchorField } from '@/fields/anchorField'
export const FDUspChecklistBlock: Block = {
slug: 'fdUspChecklist',
imageURL: '/block-thumbnails/fd-usp-checklist.png',
imageAltText: 'FD USP-checklista',
interfaceName: 'FDUspChecklistBlock',
labels: {
singular: 'FD USP-checklista',
plural: 'FD USP-checklistor',
},
fields: [
{
name: 'heading',
type: 'text',
localized: true,
label: 'Rubrik',
required: true,
},
{
name: 'items',
type: 'array',
label: 'Punkter',
minRows: 1,
fields: [
{
name: 'text',
type: 'text',
localized: true,
required: true,
label: 'Text',
},
],
},
{
name: 'image',
type: 'upload',
relationTo: 'media',
label: 'Bild (valfri)',
},
{
name: 'imageOverlay',
type: 'select',
label: 'Bildöverlagring',
defaultValue: 'none',
options: [
{ label: 'Ingen', value: 'none' },
{ label: 'Navy (lätt)', value: 'navyLight' },
{ label: 'Navy (medium)', value: 'navyMedium' },
{ label: 'Gul (lätt)', value: 'yellowLight' },
{ label: 'Gul (medium)', value: 'yellowMedium' },
{ label: 'Sepia', value: 'sepia' },
{ label: 'Svart (lätt)', value: 'blackLight' },
{ label: 'Svart (medium)', value: 'blackMedium' },
],
admin: {
condition: (_, siblingData) => Boolean(siblingData?.image),
},
},
{
name: 'imagePosition',
type: 'select',
label: 'Bildplacering',
defaultValue: 'right',
options: [
{ label: 'Höger', value: 'right' },
{ label: 'Vänster', value: 'left' },
],
},
{
name: 'checkColor',
type: 'select',
label: 'Checkikon-färg',
defaultValue: 'navy',
options: [
{ label: 'Navy (vit bock)', value: 'navy' },
{ label: 'Gul (navy bock)', value: 'yellow' },
{ label: 'Grå (navy bock)', value: 'gray' },
],
},
{
name: 'sectionBackground',
type: 'select',
label: 'Sektionsbakgrund',
defaultValue: 'white',
options: [
{ label: 'Vit', value: 'white' },
{ label: 'Grå', value: 'gray' },
{ label: 'Navy', value: 'navy' },
],
},
{
name: 'textColor',
type: 'select',
label: 'Textfärg',
defaultValue: 'navy',
options: [
{ label: 'Navy', value: 'navy' },
{ label: 'Vit', value: 'white' },
],
},
anchorField,
],
}