mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-04 09:15:58 +02:00
Only link the first folder when rendering breadcrumbs
This commit is contained in:
@@ -32,7 +32,7 @@ function flatten([
|
||||
export function Breadcrumb({ relativePath, basePath }: IBreadcrumbProps) {
|
||||
const paths = relativePath.split("/")
|
||||
const breadcrumbItems = flatten([traversePaths(paths, basePath)])
|
||||
|
||||
let count = 0;
|
||||
return (
|
||||
<SC.BreadcrumbWrapper>
|
||||
<SC.LinkWrapper>
|
||||
@@ -52,14 +52,25 @@ export function Breadcrumb({ relativePath, basePath }: IBreadcrumbProps) {
|
||||
/>
|
||||
<ChevronUp />
|
||||
</SC.LinkWrapper>
|
||||
|
||||
{breadcrumbItems.map(item => {
|
||||
if (item.type === "folder") {
|
||||
return (
|
||||
count++;
|
||||
if (count > 1) {
|
||||
return (
|
||||
<SC.LinkWrapper key={item.path}>
|
||||
<Link item={item} />
|
||||
{ item.title }
|
||||
<ChevronUp />
|
||||
</SC.LinkWrapper>
|
||||
)
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<SC.LinkWrapper key={item.path}>
|
||||
<Link item={item} />
|
||||
<ChevronUp />
|
||||
</SC.LinkWrapper>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user