@@ -31,7 +31,6 @@ import {
3131 type BaseLayoutProps ,
3232 BaseLinkItem ,
3333 getLinks ,
34- type IconItemType ,
3534 type LinkItemType ,
3635} from '@/layouts/shared' ;
3736import {
@@ -52,7 +51,6 @@ import {
5251 LargeSearchToggle ,
5352 SearchToggle ,
5453} from '@/components/layout/search-toggle' ;
55- import { HideIfEmpty } from 'fumadocs-core/hide-if-empty' ;
5654import {
5755 getSidebarTabs ,
5856 type GetSidebarTabsOptions ,
@@ -138,9 +136,7 @@ export function DocsLayout({
138136 } = sidebarProps ;
139137 if ( component ) return component ;
140138
141- const iconLinks = links . filter (
142- ( item ) : item is IconItemType => item . type === 'icon' ,
143- ) ;
139+ const iconLinks = links . filter ( ( item ) => item . type === 'icon' ) ;
144140
145141 const viewport = (
146142 < SidebarViewport >
@@ -244,32 +240,40 @@ export function DocsLayout({
244240 { banner }
245241 </ SidebarHeader >
246242 { viewport }
247- < HideIfEmpty as = { SidebarFooter } >
248- < div className = "flex text-fd-muted-foreground items-center empty:hidden" >
249- { i18n ? (
250- < LanguageToggle >
251- < Languages className = "size-4.5" / >
252- </ LanguageToggle >
253- ) : null }
254- { iconLinks . map ( ( item , i ) => (
255- < BaseLinkItem
256- key = { i }
257- item = { item }
258- className = { cn (
259- buttonVariants ( { size : 'icon-sm' , color : 'ghost' } ) ,
260- ) }
261- aria-label = { item . label }
262- >
263- { item . icon }
264- </ BaseLinkItem >
265- ) ) }
266- { themeSwitch . enabled !== false &&
267- ( themeSwitch . component ?? (
268- < ThemeToggle className = "ms-auto p-0" mode = { themeSwitch . mode } / >
243+ { ( i18n ||
244+ iconLinks . length > 0 ||
245+ themeSwitch ?. enabled !== false ||
246+ footer ) && (
247+ < SidebarFooter >
248+ < div className = "flex text-fd-muted-foreground items-center empty:hidden" >
249+ { i18n && (
250+ < LanguageToggle >
251+ < Languages className = "size-4.5" />
252+ </ LanguageToggle >
253+ ) }
254+ { iconLinks . map ( ( item , i ) => (
255+ < BaseLinkItem
256+ key = { i }
257+ item = { item }
258+ className = { cn (
259+ buttonVariants ( { size : ' icon-sm' , color : 'ghost' } ) ,
260+ ) }
261+ aria-label = { item . label }
262+ >
263+ { item . icon }
264+ </ BaseLinkItem >
269265 ) ) }
270- </ div >
271- { footer }
272- </ HideIfEmpty >
266+ { themeSwitch . enabled !== false &&
267+ ( themeSwitch . component ?? (
268+ < ThemeToggle
269+ className = "ms-auto p-0"
270+ mode = { themeSwitch . mode }
271+ />
272+ ) ) }
273+ </ div >
274+ { footer }
275+ </ SidebarFooter >
276+ ) }
273277 </ SidebarContent >
274278 ) ;
275279
0 commit comments