From 98521d8062d88a44c8d78014968e05264e9455d4 Mon Sep 17 00:00:00 2001 From: puremana Date: Wed, 12 Feb 2020 21:37:00 +1300 Subject: [PATCH 1/3] Only link the first folder when rendering breadcrumbs --- src/components/Breadcrumb/index.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/components/Breadcrumb/index.tsx b/src/components/Breadcrumb/index.tsx index a42e563..fa147e9 100644 --- a/src/components/Breadcrumb/index.tsx +++ b/src/components/Breadcrumb/index.tsx @@ -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 ( @@ -52,14 +52,25 @@ export function Breadcrumb({ relativePath, basePath }: IBreadcrumbProps) { /> + {breadcrumbItems.map(item => { if (item.type === "folder") { - return ( + count++; + if (count > 1) { + return ( - + { item.title } - ) + ) + } else { + return ( + + + + + ) + } } return ( From 5104980c91fd4164404893923319aceba869975b Mon Sep 17 00:00:00 2001 From: puremana Date: Wed, 12 Feb 2020 21:50:04 +1300 Subject: [PATCH 2/3] Fix unique key prop warning on resource sidebar --- src/components/ResourcesSidebar/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ResourcesSidebar/index.tsx b/src/components/ResourcesSidebar/index.tsx index 30b5260..c5f6456 100644 --- a/src/components/ResourcesSidebar/index.tsx +++ b/src/components/ResourcesSidebar/index.tsx @@ -99,7 +99,7 @@ function Folder({ item }: { item: IFolder }) { {sortedChildren.map(node => ( - + ))} @@ -120,7 +120,7 @@ const FirstLevelFolder = memo(({ item }: { item: IFolder }) => { {humanize(item.title)} {sortedChildren.map(node => ( - + ))} From 1e52c58aae22509a7af4ba3c2140f1b062623d66 Mon Sep 17 00:00:00 2001 From: puremana Date: Sun, 16 Feb 2020 11:49:21 +1300 Subject: [PATCH 3/3] Renamed count to foldersDepth --- src/components/Breadcrumb/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Breadcrumb/index.tsx b/src/components/Breadcrumb/index.tsx index fa147e9..0015236 100644 --- a/src/components/Breadcrumb/index.tsx +++ b/src/components/Breadcrumb/index.tsx @@ -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; + let foldersDepth = 0; return ( @@ -55,8 +55,8 @@ export function Breadcrumb({ relativePath, basePath }: IBreadcrumbProps) { {breadcrumbItems.map(item => { if (item.type === "folder") { - count++; - if (count > 1) { + foldersDepth++; + if (foldersDepth > 1) { return ( { item.title }