11import { useLocation } from "@docusaurus/router" ;
22import Link from "@docusaurus/Link" ;
33import routes from "@generated/routes" ;
4+ import styles from "./index.module.css" ;
45
56type DocusaurusRouteConfig = { path ?: string ; routes ?: DocusaurusRouteConfig [ ] } ;
67
@@ -17,14 +18,11 @@ function collectRegisteredPaths(routeList: DocusaurusRouteConfig[]): string[] {
1718 return out ;
1819}
1920
20- /** Paths Docusaurus registered at build time (docs, plugins, etc.). */
2121const KNOWN_ROUTE_PATHS = new Set ( collectRegisteredPaths ( routes as DocusaurusRouteConfig [ ] ) ) ;
2222
2323function isRegisteredRoute ( pathname : string ) : boolean {
2424 const normalized = pathname . endsWith ( "/" ) && pathname . length > 1 ? pathname . slice ( 0 , - 1 ) : pathname ;
25- if ( KNOWN_ROUTE_PATHS . has ( normalized ) ) {
26- return true ;
27- }
25+ if ( KNOWN_ROUTE_PATHS . has ( normalized ) ) return true ;
2826 return KNOWN_ROUTE_PATHS . has ( `${ normalized } /` ) ;
2927}
3028
@@ -58,21 +56,17 @@ const Breadcrumb = () => {
5856 } ) ;
5957
6058 return (
61- < nav className = "text-sm text-gray-500 mb-4 mx-16 py-5" >
62- < Link to = "/" className = "px-3 hover:bg-gray-200 rounded-full hover:no-underline" >
63- Home
64- </ Link >
59+ < nav className = { styles . nav } >
60+ < Link to = "/" className = { styles . link } > Home</ Link >
6561 { crumbs . map ( ( { label, to, isLastPart } ) => {
6662 const showLink = ! isLastPart && isRegisteredRoute ( to ) ;
6763 return (
6864 < span key = { to } >
6965 { " > " }
7066 { showLink ? (
71- < Link to = { to } className = "px-3 rounded-full hover:bg-gray-200 hover:no-underline" >
72- { label }
73- </ Link >
67+ < Link to = { to } className = { styles . link } > { label } </ Link >
7468 ) : (
75- < span className = { `px-3 rounded-full ${ isLastPart ? "bg-gray-200" : "" } ` } > { label } </ span >
69+ < span className = { isLastPart ? styles . current : undefined } > { label } </ span >
7670 ) }
7771 </ span >
7872 ) ;
@@ -84,12 +78,7 @@ const Breadcrumb = () => {
8478export default Breadcrumb ;
8579
8680const format = ( part : string ) : string => {
87- if ( part === "core" ) {
88- return "Common Cloud Controls" ;
89- }
90- if ( part === "cfi" ) {
91- return "CFI" ;
92- }
93-
81+ if ( part === "core" ) return "Common Cloud Controls" ;
82+ if ( part === "cfi" ) return "CFI" ;
9483 return part ;
9584} ;
0 commit comments