import style from '../styles/title.module.css'; import Link from 'next/link'; type propsObj = { name: string, title?: string, ancestors?: Array<{ name: string, path: string }> }; function createPathElements(ancestors: Array<{ name: string, path: string }>) { let currentPath = ''; return ancestors.map((ancestor, id) => { currentPath += `/${ancestor.path}` return ( <> {ancestor.name} <> / > > ); }); }; function Title({ name, title, ancestors }: propsObj) { const pathElements = ancestors && createPathElements(ancestors) || <>>; return ( <>