Feat/footer * chore: correct type * fix: remove redundant return type * chore: align code formatting * chore: format code to avoid diffing noise * chore: clean up format diffing noise * chore: move props tying to types folder * fix: update app_downloads usage and types * fix: improve footer query and typings * refactor: add Image.graphql * fix: correct typings
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { FooterNavigationProps } from "@/types/components/current/footer"
|
|
import { InternalLink, ExternalLink } from "@/types/requests/footer"
|
|
|
|
function getLink(linkObject: InternalLink | ExternalLink) {
|
|
if (linkObject.__typename === "FooterNavigationLinksInternalLink") {
|
|
return {
|
|
title: linkObject.internal_link.link_text,
|
|
href: linkObject.internal_link.pageConnection.edges[0].node.url,
|
|
}
|
|
}
|
|
return linkObject.external_link.link
|
|
}
|
|
|
|
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) => {
|
|
const linkItem = getLink(link)
|
|
return <li key={linkItem.title}>{linkItem.title}</li>
|
|
})}
|
|
</ul>
|
|
</div>
|
|
</li>
|
|
)
|
|
})}
|
|
</ul>
|
|
)
|
|
}
|