// @flow import React from 'react'; import { Link } from 'react-router-dom'; import type { Document, NavigationNode } from 'types'; type Props = { document: Document, pathToDocument: Array, }; const Breadcrumbs = ({ document, pathToDocument }: Props) => { if (document && document.collection) { const titleSections = pathToDocument ? pathToDocument.map(node => ( {node.title} )) : []; titleSections.unshift( {document.collection.name} ); return (  /  {titleSections.reduce((prev, curr) => [prev, ' / ', curr])} {` / ${document.title}`} ); } return null; }; export default Breadcrumbs;