diff --git a/packages/gitbook/src/components/TableOfContents/PageDocumentItem.tsx b/packages/gitbook/src/components/TableOfContents/PageDocumentItem.tsx index 4e0bcb536..6a9ef5b5f 100644 --- a/packages/gitbook/src/components/TableOfContents/PageDocumentItem.tsx +++ b/packages/gitbook/src/components/TableOfContents/PageDocumentItem.tsx @@ -38,12 +38,10 @@ export function PageDocumentItem(props: { page: ClientTOCPageDocument }) { /> ) : null } + icon={} + tag={page.primaryTag ? : null} > - - - {page.title} - {page.primaryTag ? : null} - + {page.title} ); diff --git a/packages/gitbook/src/components/TableOfContents/ToggleableLinkItem.tsx b/packages/gitbook/src/components/TableOfContents/ToggleableLinkItem.tsx index a87c6690c..37d950af5 100644 --- a/packages/gitbook/src/components/TableOfContents/ToggleableLinkItem.tsx +++ b/packages/gitbook/src/components/TableOfContents/ToggleableLinkItem.tsx @@ -13,9 +13,11 @@ export function ToggleableLinkItem( pathnames: string[]; children: React.ReactNode; descendants: React.ReactNode; + icon?: React.ReactNode; + tag?: React.ReactNode; } & LinkInsightsProps ) { - const { href, children, descendants, pathnames, insights } = props; + const { href, children, descendants, pathnames, insights, icon, tag } = props; const currentPagePath = useCurrentPagePath(); const isActive = pathnames.some((pathname) => pathname === currentPagePath); @@ -43,7 +45,15 @@ export function ToggleableLinkItem( if (!descendants) { return ( - {children} + {icon} + {tag ? ( +
+ {children} +
{tag}
+
+ ) : ( + children + )}
); } @@ -58,8 +68,21 @@ export function ToggleableLinkItem( isActive={isActive} onActiveClick={() => handleToggle(!isOpen)} > - {children} - {toggler} + {icon} + {tag ? ( +
+ {children} +
+ {tag} + {toggler} +
+
+ ) : ( + <> + {children} + {toggler} + + )} {descendants}