import type { ParsedUrlQuery } from 'querystring' import Link from 'next/link' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { useTranslation } from 'next-i18next' const HomeCrumb = () => { const { t } = useTranslation() return ( {t('Home')} ) } const Breadcrumb: React.FC<{ query?: ParsedUrlQuery }> = ({ query }) => { if (query) { const { path } = query if (Array.isArray(path)) { // We are rendering the path in reverse, so that the browser automatically scrolls to the end of the breadcrumb // https://stackoverflow.com/questions/18614301/keep-overflow-div-scrolled-to-bottom-unless-user-scrolls-up/18614561 return (
    {path .slice(0) .reverse() .map((p: string, i: number) => (
  1. encodeURIComponent(p)) .join('/')}`} passHref > {p}
  2. ))}
) } } return (
) } export default Breadcrumb