feat(SW-187): use custom title for links
This commit is contained in:
@@ -17,6 +17,7 @@ query GetFooter($locale: String!) {
|
|||||||
all_footer(limit: 1, locale: $locale) {
|
all_footer(limit: 1, locale: $locale) {
|
||||||
items {
|
items {
|
||||||
main_links {
|
main_links {
|
||||||
|
title
|
||||||
open_in_new_tab
|
open_in_new_tab
|
||||||
link {
|
link {
|
||||||
href
|
href
|
||||||
@@ -35,6 +36,7 @@ query GetFooter($locale: String!) {
|
|||||||
secondary_links {
|
secondary_links {
|
||||||
title
|
title
|
||||||
links {
|
links {
|
||||||
|
title
|
||||||
open_in_new_tab
|
open_in_new_tab
|
||||||
pageConnection {
|
pageConnection {
|
||||||
edges {
|
edges {
|
||||||
@@ -52,6 +54,7 @@ query GetFooter($locale: String!) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
tertiary_links {
|
tertiary_links {
|
||||||
|
title
|
||||||
open_in_new_tab
|
open_in_new_tab
|
||||||
link {
|
link {
|
||||||
href
|
href
|
||||||
|
|||||||
@@ -318,6 +318,7 @@ const validateInternalLink = z
|
|||||||
|
|
||||||
export const validateLinkItem = z
|
export const validateLinkItem = z
|
||||||
.object({
|
.object({
|
||||||
|
title: z.string(),
|
||||||
open_in_new_tab: z.boolean(),
|
open_in_new_tab: z.boolean(),
|
||||||
link: validateExternalLink,
|
link: validateExternalLink,
|
||||||
pageConnection: validateInternalLink,
|
pageConnection: validateInternalLink,
|
||||||
@@ -325,7 +326,7 @@ export const validateLinkItem = z
|
|||||||
.transform((data) => {
|
.transform((data) => {
|
||||||
return {
|
return {
|
||||||
url: data.pageConnection?.url ?? data.link?.href ?? "",
|
url: data.pageConnection?.url ?? data.link?.href ?? "",
|
||||||
title: data.pageConnection?.title ?? data.link?.title,
|
title: data?.title ?? data.link?.title,
|
||||||
openInNewTab: data.open_in_new_tab,
|
openInNewTab: data.open_in_new_tab,
|
||||||
isExternal: !!data.link?.href,
|
isExternal: !!data.link?.href,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user