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

@@ -36,6 +36,7 @@ import {
linkAndTitleSchema,
linkConnectionRefs,
} from "../schemas/linkConnection"
import { internalOrExternalLinkSchema } from "../schemas/pageLinks"
import {
contentRefsSchema as sidebarContentRefsSchema,
contentSchema as sidebarContentSchema,
@@ -189,18 +190,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 contentPageSchema = z.object({
content_page: z.object({
@@ -211,7 +200,7 @@ export const contentPageSchema = z.object({
header: z.object({
heading: z.string(),
preamble: z.string(),
top_primary_button: topPrimaryButtonSchema,
top_primary_button: internalOrExternalLinkSchema,
navigation_links: navigationLinksSchema,
dynamic_content: headerDynamicContentSchema.nullish(),
}),