85 lines
1.9 KiB
TypeScript
85 lines
1.9 KiB
TypeScript
import type { GlobalConfig } from 'payload'
|
|
import { link } from '@/fields/link'
|
|
import { revalidateFooter } from './hooks/revalidateFooter'
|
|
|
|
export const Footer: GlobalConfig = {
|
|
slug: 'footer',
|
|
access: {
|
|
read: () => true,
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'columns',
|
|
type: 'array',
|
|
label: 'Kolumner',
|
|
minRows: 1,
|
|
maxRows: 5,
|
|
admin: {
|
|
description: 'Footer-kolumner med rubriker och länkar (sitemap-stil)',
|
|
initCollapsed: true,
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'heading',
|
|
type: 'text',
|
|
label: 'Kolumnrubrik',
|
|
required: true,
|
|
admin: {
|
|
description: 'T.ex. "Tjänster", "Om oss", "Support"',
|
|
},
|
|
},
|
|
{
|
|
name: 'links',
|
|
type: 'array',
|
|
label: 'Länkar',
|
|
fields: [
|
|
link({
|
|
appearances: false,
|
|
}),
|
|
],
|
|
maxRows: 8,
|
|
admin: {
|
|
initCollapsed: true,
|
|
components: {
|
|
RowLabel: '@/Footer/RowLabel#RowLabel',
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'navItems',
|
|
type: 'array',
|
|
label: 'Enkel navigering (äldre)',
|
|
admin: {
|
|
description: 'Enkla footer-länkar (visas om inga kolumner finns)',
|
|
initCollapsed: true,
|
|
},
|
|
fields: [
|
|
link({
|
|
appearances: false,
|
|
}),
|
|
],
|
|
maxRows: 6,
|
|
},
|
|
{
|
|
name: 'bottomLeftText',
|
|
type: 'text',
|
|
label: 'Nedre vänster text',
|
|
defaultValue: '© {year} Fiber Direkt. Alla rättigheter förbehållna.',
|
|
admin: {
|
|
description: 'Använd {year} för aktuellt årtal',
|
|
},
|
|
},
|
|
{
|
|
name: 'bottomRightText',
|
|
type: 'text',
|
|
label: 'Nedre höger text',
|
|
defaultValue: 'Svenskt datacenter · ISO 27001 · ISO 14001',
|
|
},
|
|
],
|
|
hooks: {
|
|
afterChange: [revalidateFooter],
|
|
},
|
|
}
|