import React, { StatelessComponent, ReactElement } from 'react'; import { SilverstripeDocument } from '../types'; import { Link } from 'gatsby'; import classnames from 'classnames'; import { LinkGetProps } from '@reach/router'; import useHierarchy from '../hooks/useHierarchy'; interface NavProps { onNavigate?(e: React.MouseEvent): void; }; const getLinkProps = (props: LinkGetProps): {} => { const { isPartiallyCurrent, isCurrent } = props; return { className: classnames({ 'active': isCurrent, 'section': isPartiallyCurrent, 'nav-link': true, }), }; }; const Nav:StatelessComponent = ({ onNavigate }): ReactElement => { const { getNavChildren, getHomePage, getCurrentNode, } = useHierarchy(); const currentNode = getCurrentNode(); const top = getHomePage(); if (!top) { return