feat(SW-187): App badges localization
This commit is contained in:
@@ -1,10 +1,24 @@
|
||||
import type { FooterLinkItem } from "./output"
|
||||
|
||||
export function transformPageConnectionLinks(links: FooterLinkItem[]) {
|
||||
return links.flatMap((link) =>
|
||||
link.pageConnection?.edges.map((edge) => ({
|
||||
title: edge.node.title,
|
||||
url: edge.node.url,
|
||||
}))
|
||||
)
|
||||
console.log("linksdata", links[0].pageConnection?.edges)
|
||||
if (!links) return []
|
||||
return links.flatMap((link) => {
|
||||
if (link.pageConnection?.edges.length) {
|
||||
return link.pageConnection.edges.map((edge) => ({
|
||||
title: edge.node.title || "",
|
||||
url: edge.node.url || "",
|
||||
openInNewTab: link.open_in_new_tab,
|
||||
}))
|
||||
} else if (link.link) {
|
||||
return [
|
||||
{
|
||||
title: link.link.title,
|
||||
url: link.link.href,
|
||||
openInNewTab: link.open_in_new_tab,
|
||||
},
|
||||
]
|
||||
}
|
||||
return []
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user