fix(SW-190): added linkConnectionNode as variable for readability
This commit is contained in:
@@ -84,18 +84,19 @@ export function makeButtonObject(button: any) {
|
|||||||
|
|
||||||
const isContenstackLink =
|
const isContenstackLink =
|
||||||
button?.is_contentstack_link || button.linkConnection?.edges?.length
|
button?.is_contentstack_link || button.linkConnection?.edges?.length
|
||||||
|
const linkConnnectionNode = button.linkConnection.edges[0].node
|
||||||
|
|
||||||
return {
|
return {
|
||||||
openInNewTab: button?.open_in_new_tab,
|
openInNewTab: button?.open_in_new_tab,
|
||||||
title:
|
title:
|
||||||
button.cta_text ||
|
button.cta_text ||
|
||||||
(isContenstackLink
|
(isContenstackLink
|
||||||
? button.linkConnection.edges[0].node.title
|
? linkConnnectionNode.title
|
||||||
: button.external_link.title),
|
: button.external_link.title),
|
||||||
href: isContenstackLink
|
href: isContenstackLink
|
||||||
? button.linkConnection.edges[0].node.web?.original_url ||
|
? linkConnnectionNode.web?.original_url ||
|
||||||
removeMultipleSlashes(
|
removeMultipleSlashes(
|
||||||
`/${button.linkConnection.edges[0].node.system.locale}/${button.linkConnection.edges[0].node.url}`
|
`/${linkConnnectionNode.system.locale}/${linkConnnectionNode.url}`
|
||||||
)
|
)
|
||||||
: button.external_link.href,
|
: button.external_link.href,
|
||||||
isExternal: !isContenstackLink,
|
isExternal: !isContenstackLink,
|
||||||
|
|||||||
Reference in New Issue
Block a user