wwwfiberdirekt/src/blocks/FDAlternateHeroBlock/config.ts

103 lines
2.6 KiB
TypeScript

import type { Block } from 'payload'
import { anchorField } from '@/fields/anchorField'
export const FDAlternateHeroBlock: Block = {
slug: 'fdAlternateHero',
imageURL: '/block-thumbnails/fd-header-text-image-alt.png',
imageAltText: 'FD Alternativ Hero',
interfaceName: 'FDAlternateHeroBlock',
labels: {
singular: 'FD Alternativ Hero (centrerad)',
plural: 'FD Alternativa Heroes',
},
fields: [
{
name: 'heading',
type: 'text',
localized: true,
required: true,
label: 'Rubrik',
},
{
name: 'description',
type: 'textarea',
localized: true,
label: 'Beskrivning (valfri)',
},
{
name: 'primaryCtaText',
type: 'text',
localized: true,
label: 'Primär CTA-knapp text (valfri)',
},
{
name: 'primaryCtaLink',
type: 'text',
localized: true,
label: 'Primär CTA-knapp länk',
defaultValue: '/kontakt',
},
{
name: 'secondaryCtaText',
type: 'text',
localized: true,
label: 'Sekundär CTA-knapp text (valfri)',
},
{
name: 'secondaryCtaLink',
type: 'text',
localized: true,
label: 'Sekundär CTA-knapp länk',
defaultValue: '#',
},
{
name: 'image',
type: 'upload',
relationTo: 'media',
label: 'Fullbredd bild (visas under texten)',
admin: {
description: 'Bred bild utan border-radius — visas som en full showcase under CTA-knapparna.',
},
},
{
name: 'imageCaption',
type: 'text',
localized: true,
label: 'Bildtext (valfri)',
admin: {
condition: (_, siblingData) => Boolean(siblingData?.image),
},
},
{
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: 'sectionBackground',
type: 'select',
label: 'Sektionsbakgrund',
defaultValue: 'white',
options: [
{ label: 'Vit', value: 'white' },
{ label: 'Navy', value: 'navy' },
{ label: 'Grå', value: 'gray' },
],
},
anchorField,
],
}