interface FilesBreadcrumbProps { path: string; } export default function FilesBreadcrumb({ path }: FilesBreadcrumbProps) { if (path === '/') { return (

All files

); } const pathParts = path.slice(1, -1).split('/'); return (

All files {pathParts.map((part, index) => { if (index === pathParts.length - 1) { return ( <> / {part} ); } const fullPathForPart: string[] = []; for (let pathPartIndex = 0; pathPartIndex <= index; ++pathPartIndex) { fullPathForPart.push(pathParts[pathPartIndex]); } return ( <> / {part} ); })}

); }