@@ -56,6 +56,59 @@ function shouldShowVersionSelect(
5656 ) ;
5757}
5858
59+ function LeftNavTitle ( { selectedNavItem } : { selectedNavItem : NavItemConfig } ) {
60+ const theme = useTheme ( ) ;
61+ const hasEndIcon =
62+ selectedNavItem . endIcon !== null && selectedNavItem . endIcon !== undefined ;
63+
64+ return (
65+ < Box
66+ sx = { {
67+ borderRadius : "4px" ,
68+ "&:hover" : {
69+ backgroundColor : theme . palette . carbon [ 200 ] ,
70+ } ,
71+ } }
72+ >
73+ < LinkComponent
74+ isI18n = { selectedNavItem . isI18n ?? true }
75+ to = { selectedNavItem . to }
76+ style = { { textDecoration : "none" , display : "block" } }
77+ onClick = { ( ) => {
78+ clearAllNavStates ( ) ;
79+ } }
80+ >
81+ < Typography
82+ variant = "h6"
83+ component = "div"
84+ sx = { {
85+ fontSize : "18px" ,
86+ fontWeight : 700 ,
87+ color : theme . palette . carbon [ 900 ] ,
88+ padding : "8px" ,
89+ display : "inline-flex" ,
90+ alignItems : "center" ,
91+ gap : 1 ,
92+ } }
93+ >
94+ { selectedNavItem . leftNavLabel ?? selectedNavItem . label }
95+ { hasEndIcon && (
96+ < Box
97+ component = "span"
98+ sx = { {
99+ display : "inline-flex" ,
100+ alignItems : "center" ,
101+ } }
102+ >
103+ { selectedNavItem . endIcon }
104+ </ Box >
105+ ) }
106+ </ Typography >
107+ </ LinkComponent >
108+ </ Box >
109+ ) ;
110+ }
111+
59112export function LeftNavDesktop ( props : LeftNavProps ) {
60113 const {
61114 data,
@@ -67,7 +120,6 @@ export function LeftNavDesktop(props: LeftNavProps) {
67120 selectedNavItem,
68121 namespace,
69122 } = props ;
70- const theme = useTheme ( ) ;
71123
72124 return (
73125 < Box
@@ -96,50 +148,7 @@ export function LeftNavDesktop(props: LeftNavProps) {
96148 >
97149 < LeftNavStickyContainer top = { 0 } paddingTop = "20px" >
98150 { selectedNavItem && (
99- < Box
100- sx = { {
101- borderRadius : "4px" ,
102- "&:hover" : {
103- backgroundColor : theme . palette . carbon [ 200 ] ,
104- } ,
105- } }
106- >
107- < LinkComponent
108- isI18n = { selectedNavItem . isI18n ?? true }
109- to = { selectedNavItem . to }
110- style = { { textDecoration : "none" , display : "block" } }
111- onClick = { ( ) => {
112- clearAllNavStates ( ) ;
113- } }
114- >
115- < Typography
116- variant = "h6"
117- component = "div"
118- sx = { {
119- fontSize : "18px" ,
120- fontWeight : 700 ,
121- color : theme . palette . carbon [ 900 ] ,
122- padding : "8px" ,
123- display : "inline-flex" ,
124- alignItems : "center" ,
125- gap : 1 ,
126- } }
127- >
128- { selectedNavItem . leftNavLabel ?? selectedNavItem . label }
129- { selectedNavItem . endIcon && (
130- < Box
131- component = "span"
132- sx = { {
133- display : "inline-flex" ,
134- alignItems : "center" ,
135- } }
136- >
137- { selectedNavItem . endIcon }
138- </ Box >
139- ) }
140- </ Typography >
141- </ LinkComponent >
142- </ Box >
151+ < LeftNavTitle selectedNavItem = { selectedNavItem } />
143152 ) }
144153
145154 { shouldShowVersionSelect ( namespace , pathConfig . repo , buildType ) && (
@@ -162,8 +171,16 @@ export function LeftNavDesktop(props: LeftNavProps) {
162171}
163172
164173export function LeftNavMobile ( props : LeftNavProps ) {
165- const { data, current, name, pathConfig, availIn, buildType, namespace } =
166- props ;
174+ const {
175+ data,
176+ current,
177+ name,
178+ pathConfig,
179+ availIn,
180+ buildType,
181+ namespace,
182+ selectedNavItem,
183+ } = props ;
167184
168185 const [ open , setOpen ] = React . useState ( false ) ;
169186
@@ -224,6 +241,11 @@ export function LeftNavMobile(props: LeftNavProps) {
224241
225242 < Divider />
226243 < Box sx = { { width : "17.125rem" , padding : "1rem" } } >
244+ { selectedNavItem && (
245+ < Box sx = { { marginBottom : 1 } } >
246+ < LeftNavTitle selectedNavItem = { selectedNavItem } />
247+ </ Box >
248+ ) }
227249 < LeftNavTree data = { data } current = { current } />
228250 </ Box >
229251 </ Drawer >
0 commit comments