11import Link from 'next/link' ;
22
3- import { nodeForPath , sidebarOrderSorter } from 'sentry-docs/docTree' ;
3+ import { nodeForPath } from 'sentry-docs/docTree' ;
44import { serverContext } from 'sentry-docs/serverContext' ;
5+ import { sortPages } from 'sentry-docs/utils' ;
56
67type Props = {
78 nextPages : boolean ;
@@ -25,18 +26,23 @@ export function PageGrid({header, exclude}: Props) {
2526 < nav >
2627 { header && < h2 > { header } </ h2 > }
2728 < ul >
28- { parentNode . children
29- /* NOTE: temp fix while we figure out the reason why some nodes have empty front matter */
30- . filter ( c => c . frontmatter . title && ! exclude ?. includes ( c . slug ) )
31- . sort ( ( a , b ) => sidebarOrderSorter ( a . frontmatter , b . frontmatter ) )
32- . map ( n => (
33- < li key = { n . path } style = { { marginBottom : '1rem' } } >
34- < h4 style = { { marginBottom : '0px' } } >
35- < Link href = { '/' + n . path } > { n . frontmatter . title } </ Link >
36- </ h4 >
37- { n . frontmatter . description && < p > { n . frontmatter . description } </ p > }
38- </ li >
39- ) ) }
29+ { sortPages (
30+ parentNode . children . filter (
31+ c =>
32+ ! c . frontmatter . sidebar_hidden &&
33+ c . frontmatter . title &&
34+ ! exclude ?. includes ( c . slug )
35+ ) ,
36+ // a hacky adapter to reuse the same sidebar sorter
37+ node => ( { ...node , context : node . frontmatter } )
38+ ) . map ( n => (
39+ < li key = { n . path } style = { { marginBottom : '1rem' } } >
40+ < h4 style = { { marginBottom : '0px' } } >
41+ < Link href = { '/' + n . path } > { n . frontmatter . title } </ Link >
42+ </ h4 >
43+ { n . frontmatter . description && < p > { n . frontmatter . description } </ p > }
44+ </ li >
45+ ) ) }
4046 </ ul >
4147 </ nav >
4248 ) ;
0 commit comments