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:
@@ -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(),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user