@@ -30,29 +30,31 @@ type Props = {
3030const { title = true , class : className, ... props } = Astro .props
3131---
3232
33- <docs-toc class ={ cn (' not-prose' , className )} {... props }>
34- { title && <h2 class = ' text-foreground font-semibold' >DOCS</h2 >}
35- <ul class =' mt-4 flex flex-col gap-y-5' >
36- {
37- Object .entries (docCategories ).map (([id , title ]: [string , string ]) => (
38- <li >
39- <h3 class = ' text-muted-foreground text-xs tracking-widest uppercase' >{ title } </h3 >
40- <ul class = ' mt-2 flex flex-col' >
41- { docsByCate [id ]
42- .sort ((a , b ) => a .data .order - b .data .order )
43- .map ((doc ) => (
44- <li class = ' docs-item flex relative ms-2 px-3 py-1 text-foreground/75 transition-all rounded-2xl' >
45- <a class = ' flex-1 hover:text-foreground' href = { ` /docs/${doc .id } ` } >
46- { doc .data .title }
47- </a >
48- </li >
49- ))}
50- </ul >
51- </li >
52- ))
53- }
54- </ul >
55- </docs-toc>
33+ { docsCollection .length > 0 && (
34+ <docs-toc class = { cn (' not-prose' , className )} { ... props } >
35+ { title && <h2 class = ' text-foreground font-semibold' >DOCS</h2 >}
36+ <ul class = ' mt-4 flex flex-col gap-y-5' >
37+ {
38+ Object .entries (docCategories ).map (([id , title ]: [string , string ]) => (
39+ <li >
40+ <h3 class = ' text-muted-foreground text-xs tracking-widest uppercase' >{ title } </h3 >
41+ <ul class = ' mt-2 flex flex-col' >
42+ { docsByCate [id ]
43+ .sort ((a , b ) => a .data .order - b .data .order )
44+ .map ((doc ) => (
45+ <li class = ' docs-item flex relative ms-2 px-3 py-1 text-foreground/75 transition-all rounded-2xl' >
46+ <a class = ' flex-1 hover:text-foreground' href = { ` /docs/${doc .id } ` } >
47+ { doc .data .title }
48+ </a >
49+ </li >
50+ ))}
51+ </ul >
52+ </li >
53+ ))
54+ }
55+ </ul >
56+ </docs-toc >
57+ )}
5658
5759<style >
5860 docs-toc .docs-item::before {
0 commit comments