feat(SW-3108): Added external link option to top primary button on content/collection page

Approved-by: Matilda Landström
This commit is contained in:
Erik Tiekstra
2025-09-15 06:47:10 +00:00
parent ce71fc421c
commit 5654569a11
5 changed files with 56 additions and 26 deletions

View File

@@ -21,6 +21,7 @@ import {
linkAndTitleSchema,
linkConnectionRefs,
} from "../schemas/linkConnection"
import { internalOrExternalLinkSchema } from "../schemas/pageLinks"
import { systemSchema } from "../schemas/system"
// Block schemas
@@ -73,18 +74,6 @@ const navigationLinksSchema = z
}))
})
const topPrimaryButtonSchema = linkAndTitleSchema
.nullable()
.transform((data) => {
if (!data?.link) {
return null
}
return {
url: data.link.url,
title: data.title || data.link.title || null,
}
})
// Content Page Schema and types
export const collectionPageSchema = z.object({
collection_page: z.object({
@@ -94,7 +83,7 @@ export const collectionPageSchema = z.object({
header: z.object({
heading: z.string(),
preamble: z.string(),
top_primary_button: topPrimaryButtonSchema,
top_primary_button: internalOrExternalLinkSchema,
navigation_links: navigationLinksSchema,
}),
meeting_package: z