import React from 'react'
import { THeaderProps } from '../../interfaces'
import { ariaSelected } from '../../utils'
import {
TNavMenuItem,
TNavMeganav,
INavMeganavSections,
INavMeganavArticles
} from '@financial-times/dotcom-types-navigation'
const MobileNav = (props: THeaderProps) => {
// Only display navigation on pages which are included in this menu
const targetUrls = props.data['navbar-simple'].items.map((item) => item.url)
return props.data.currentPath && targetUrls.includes(props.data.currentPath) ? (
) : null
}
const NavMobile = ({ items }: { items: TNavMenuItem[] }) => {
return (
)
}
const NavDesktop = (props) => (
)
const NavListLeft = (props: THeaderProps) => (
{props.data.navbar.items.map((item, index) => (
-
{props.showMegaNav && Array.isArray(item.meganav) ? (
) : null}
))}
)
const NavListRight = (props: THeaderProps) => {
let navbarRightItems = props.data['navbar-right'].items;
// If the pro navigation is to be shown
// Remove the myFT link from the right navigation
// since there will be a link to it in the pro navigation
if(props.showProNavigation) {
navbarRightItems = navbarRightItems.filter(item => item.label !== 'myFT');
}
return props.userIsLoggedIn ? (
) : null
}
const NavListRightLoggedIn = ({
items,
}: {
items: TNavMenuItem[]
}) => {
return (
)
}
const MegaNav = ({ label, meganav, index }: { label: string; meganav: TNavMeganav[]; index: number }) => {
const sections = meganav.find(({ component }) => component === 'sectionlist')
const articles = meganav.find(({ component }) => component === 'articlelist')
return (
)
}
const SectionList = ({ title, data }: INavMeganavSections) => {
return (
{title}
{data?.map((column) =>
column.map((item, index) => (
-
{item.label}
))
)}
)
}
const ArticleList = ({ title, data }: INavMeganavArticles) => {
return (
)
}
const UserActionsNav = (props: THeaderProps) => {
const userNavItems = props.data['navbar-right-anon'].items
return (
)
}
export { NavDesktop, NavListLeft, NavListRight, UserActionsNav, MobileNav }