feat: manage contact form copy via payload
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import type { Field } from 'payload'
|
||||
|
||||
import { contactFormContent } from '@/spa/contactFormContent'
|
||||
|
||||
const uploadField = (name: string, label: string, description?: string): Field => ({
|
||||
name,
|
||||
type: 'upload',
|
||||
@@ -96,6 +98,82 @@ export const contactFields: Field[] = [
|
||||
text('formImageLabel', 'Form image label', 'Gala 2025 München'),
|
||||
text('formEyebrow', 'Form eyebrow', 'Kontaktformular'),
|
||||
text('formTitle', 'Form title', 'Schreiben Sie uns'),
|
||||
{
|
||||
name: 'formCopy',
|
||||
label: 'Contact form copy',
|
||||
type: 'group',
|
||||
admin: sectionAdmin('Step labels, subject choices, field labels, validation messages, and success copy.'),
|
||||
fields: [
|
||||
{
|
||||
name: 'steps',
|
||||
label: 'Step labels',
|
||||
type: 'array',
|
||||
defaultValue: contactFormContent.steps,
|
||||
fields: [text('label', 'Label')],
|
||||
},
|
||||
{
|
||||
name: 'subjects',
|
||||
label: 'Subject choices',
|
||||
type: 'array',
|
||||
defaultValue: contactFormContent.subjects,
|
||||
fields: [text('value', 'Value'), text('label', 'Label'), textarea('desc', 'Description')],
|
||||
},
|
||||
{
|
||||
name: 'prompts',
|
||||
label: 'Prompts',
|
||||
type: 'group',
|
||||
fields: [
|
||||
text('subject', 'Subject step prompt', contactFormContent.prompts.subject),
|
||||
text('contact', 'Contact step prompt', contactFormContent.prompts.contact),
|
||||
text('message', 'Message step prompt', contactFormContent.prompts.message),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'fields',
|
||||
label: 'Fields',
|
||||
type: 'group',
|
||||
fields: [
|
||||
text('nameLabel', 'Name label', contactFormContent.fields.nameLabel),
|
||||
text('namePlaceholder', 'Name placeholder', contactFormContent.fields.namePlaceholder),
|
||||
text('emailLabel', 'Email label', contactFormContent.fields.emailLabel),
|
||||
text('emailPlaceholder', 'Email placeholder', contactFormContent.fields.emailPlaceholder),
|
||||
text('messageLabel', 'Message label', contactFormContent.fields.messageLabel),
|
||||
text('messagePlaceholder', 'Message placeholder', contactFormContent.fields.messagePlaceholder),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'validation',
|
||||
label: 'Validation messages',
|
||||
type: 'group',
|
||||
fields: [
|
||||
text('nameRequired', 'Name required', contactFormContent.validation.nameRequired),
|
||||
text('emailRequired', 'Email required', contactFormContent.validation.emailRequired),
|
||||
text('emailInvalid', 'Email invalid', contactFormContent.validation.emailInvalid),
|
||||
text('messageRequired', 'Message required', contactFormContent.validation.messageRequired),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'navigation',
|
||||
label: 'Navigation labels',
|
||||
type: 'group',
|
||||
fields: [
|
||||
text('back', 'Back', contactFormContent.navigation.back),
|
||||
text('next', 'Next', contactFormContent.navigation.next),
|
||||
text('submit', 'Submit', contactFormContent.navigation.submit),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'success',
|
||||
label: 'Success copy',
|
||||
type: 'group',
|
||||
fields: [
|
||||
text('heading', 'Heading', contactFormContent.success.heading),
|
||||
text('prefix', 'Prefix', contactFormContent.success.prefix),
|
||||
text('suffixBeforeEmail', 'Suffix before email', contactFormContent.success.suffixBeforeEmail),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user