fix: add missing footer links
This commit is contained in:
@@ -1,17 +1,32 @@
|
||||
import { FooterNavigationProps } from "@/types/components/current/footer"
|
||||
import { InternalLink, ExternalLink } from "@/types/requests/footer"
|
||||
import {
|
||||
FooterNavigationProps,
|
||||
FooterNavigationItemProps,
|
||||
} from "@/types/components/current/footer"
|
||||
import Link from "next/link"
|
||||
|
||||
function getLink(linkObject: InternalLink | ExternalLink) {
|
||||
function NavigationItem({ linkObject, lang }: FooterNavigationItemProps) {
|
||||
if (linkObject.__typename === "FooterNavigationLinksInternalLink") {
|
||||
return {
|
||||
title: linkObject.internal_link.link_text,
|
||||
href: linkObject.internal_link.pageConnection.edges[0].node.url,
|
||||
}
|
||||
console.log({ foobar: JSON.stringify(linkObject) })
|
||||
const href = `/${lang}${linkObject.internal_link.pageConnection.edges[0].node.url}`
|
||||
return (
|
||||
<li>
|
||||
<Link href={href}>{linkObject.internal_link.link_text}</Link>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
return linkObject.external_link.link
|
||||
return (
|
||||
<li>
|
||||
<a href={linkObject.external_link.link.href}>
|
||||
{linkObject.external_link.link.title}
|
||||
</a>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
export default function Navigation({ linkGroups }: FooterNavigationProps) {
|
||||
export default function Navigation({
|
||||
linkGroups,
|
||||
lang,
|
||||
}: FooterNavigationProps) {
|
||||
return (
|
||||
<ul className="l-footer-sections global-footer__content__sections">
|
||||
{linkGroups.map((group) => {
|
||||
@@ -20,9 +35,12 @@ export default function Navigation({ linkGroups }: FooterNavigationProps) {
|
||||
<div className="link-list">
|
||||
<h3 className="link-list-header">{group.title}</h3>
|
||||
<ul className="list-footer-pages">
|
||||
{group.links.map((link) => {
|
||||
const linkItem = getLink(link)
|
||||
return <li key={linkItem.title}>{linkItem.title}</li>
|
||||
{group.links.map((link, idx) => {
|
||||
console.log({ foobar: link })
|
||||
|
||||
return (
|
||||
<NavigationItem key={idx} linkObject={link} lang={lang} />
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user