feat(WEB-111): adjust footer for updated model
This commit is contained in:
@@ -1,49 +1,24 @@
|
||||
import {
|
||||
FooterNavigationProps,
|
||||
FooterNavigationItemProps,
|
||||
} from "@/types/components/current/footer"
|
||||
import Link from "next/link"
|
||||
import type { FooterNavigationProps } from "@/types/components/current/footer"
|
||||
|
||||
function NavigationItem({ linkObject, lang }: FooterNavigationItemProps) {
|
||||
if (linkObject.__typename === "FooterNavigationLinksInternalLink") {
|
||||
const href = `/${lang}${linkObject.internal_link.pageConnection.edges[0].node.url}`
|
||||
return (
|
||||
<li>
|
||||
<Link href={href}>{linkObject.internal_link.link_text}</Link>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<li>
|
||||
<a href={linkObject.external_link.link.href}>
|
||||
{linkObject.external_link.link.title}
|
||||
</a>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
export default function Navigation({
|
||||
linkGroups,
|
||||
lang,
|
||||
}: FooterNavigationProps) {
|
||||
export default function Navigation({ linkGroups }: FooterNavigationProps) {
|
||||
return (
|
||||
<ul className="l-footer-sections global-footer__content__sections">
|
||||
{linkGroups.map((group) => {
|
||||
return (
|
||||
<li className="global-footer-section" key={group.title}>
|
||||
<div className="link-list">
|
||||
<h3 className="link-list-header">{group.title}</h3>
|
||||
<ul className="list-footer-pages">
|
||||
{group.links.map((link, idx) => {
|
||||
return (
|
||||
<NavigationItem key={idx} linkObject={link} lang={lang} />
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
{linkGroups.map((group) => (
|
||||
<li className="global-footer-section" key={group.title}>
|
||||
<div className="link-list">
|
||||
<h3 className="link-list-header">{group.title}</h3>
|
||||
<ul className="list-footer-pages">
|
||||
{group.links.map(link => (
|
||||
<li key={link.href}>
|
||||
<a href={link.href}>
|
||||
{link.title}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ export default async function Footer({ lang }: LangParams) {
|
||||
data-js-collapsible="global-footer"
|
||||
className="collapsible-global-footer"
|
||||
>
|
||||
<Navigation lang={lang} linkGroups={footerData.navigation} />
|
||||
<Navigation linkGroups={footerData.navigation} />
|
||||
|
||||
<div className="global-footer__content__bottom">
|
||||
<p className="newFooterTitle">
|
||||
|
||||
@@ -1,33 +1,9 @@
|
||||
#import "../PageLinks.graphql"
|
||||
|
||||
fragment Navigation on Footer {
|
||||
navigation {
|
||||
links {
|
||||
... on FooterNavigationLinksInternalLink {
|
||||
__typename
|
||||
internal_link {
|
||||
link_text
|
||||
pageConnection {
|
||||
edges {
|
||||
node {
|
||||
__typename
|
||||
...CurrentBlocksPageLink
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
... on FooterNavigationLinksExternalLink {
|
||||
__typename
|
||||
external_link {
|
||||
link {
|
||||
href
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
href
|
||||
title
|
||||
}
|
||||
|
||||
title
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
import { Lang } from "@/types/lang"
|
||||
import {
|
||||
ExternalLink,
|
||||
InternalLink,
|
||||
NavigationItem,
|
||||
} from "@/types/requests/footer"
|
||||
import type { NavigationItem } from "@/types/requests/footer"
|
||||
|
||||
export type FooterNavigationProps = {
|
||||
linkGroups: NavigationItem[]
|
||||
lang: Lang
|
||||
}
|
||||
|
||||
export type FooterNavigationItemProps = {
|
||||
linkObject: InternalLink | ExternalLink
|
||||
lang: Lang
|
||||
}
|
||||
|
||||
@@ -1,33 +1,19 @@
|
||||
import type { AllRequestResponse } from "./utils/all"
|
||||
import type { Edges } from "./utils/edges"
|
||||
import type { Image } from "../image"
|
||||
import type { PageLink } from "./utils/pageLink"
|
||||
|
||||
type AppDownload = {
|
||||
href: string
|
||||
imageConnection: Edges<Image>
|
||||
}
|
||||
|
||||
export type InternalLink = {
|
||||
__typename: "FooterNavigationLinksInternalLink"
|
||||
internal_link: {
|
||||
link_text: string
|
||||
pageConnection: Edges<PageLink>
|
||||
}
|
||||
}
|
||||
|
||||
export type ExternalLink = {
|
||||
__typename: "FooterNavigationLinksExternalLink"
|
||||
external_link: {
|
||||
link: {
|
||||
href: string
|
||||
title: string
|
||||
}
|
||||
}
|
||||
export type Link = {
|
||||
href: string
|
||||
title: string
|
||||
}
|
||||
|
||||
export type NavigationItem = {
|
||||
links: (ExternalLink | InternalLink)[]
|
||||
links: Link[]
|
||||
title: string
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user