@@ -113,10 +113,13 @@ class Nav extends Component<NavProps, NavState> {
113113 } : {
114114 id : string
115115 title : string
116- children : React . ReactNode [ ]
116+ children : React . ReactNode
117117 variant ?: 'section' | 'category'
118118 } ) : React . ReactNode {
119- if ( children . length === 0 ) {
119+ if (
120+ React . isValidElement ( children ) &&
121+ React . Children . count ( children . props . children ) === 0
122+ ) {
120123 return
121124 }
122125
@@ -201,6 +204,7 @@ class Nav extends Component<NavProps, NavState> {
201204
202205 return (
203206 < View
207+ as = "li"
204208 display = "block"
205209 key = { docId }
206210 margin = "xx-small none xx-small"
@@ -229,7 +233,7 @@ class Nav extends Component<NavProps, NavState> {
229233 renderSectionChildren (
230234 sectionId : string ,
231235 markExpanded : ( sectionId : string ) => void
232- ) : React . ReactNode [ ] {
236+ ) : React . ReactNode {
233237 const children : Record <
234238 string ,
235239 { id : string ; section ?: boolean ; order ?: string }
@@ -249,33 +253,37 @@ class Nav extends Component<NavProps, NavState> {
249253 }
250254 )
251255
252- return Object . keys ( children )
253- . sort ( ( a , b ) => {
254- const orderA = children [ a ] . order ? children [ a ] . order : ''
255- const orderB = children [ b ] . order ? children [ b ] . order : ''
256- const idA = `${ orderA } ${ a . toUpperCase ( ) } `
257- const idB = `${ orderB } ${ b . toUpperCase ( ) } `
258- if ( idA < idB ) {
259- return - 1
260- }
261- if ( idA > idB ) {
262- return 1
263- }
264- return 0
265- } )
266- . map ( ( id ) => {
267- if ( children [ id ] . section ) {
268- return this . renderSectionLink (
269- children [ id ] . id ,
270- ( ) => {
271- markExpanded ( sectionId )
272- } ,
273- 'category'
274- )
275- } else {
276- return this . renderDocLink ( id )
277- }
278- } )
256+ return (
257+ < ul style = { { paddingLeft : '0px' , margin : '0px' } } >
258+ { Object . keys ( children )
259+ . sort ( ( a , b ) => {
260+ const orderA = children [ a ] . order ? children [ a ] . order : ''
261+ const orderB = children [ b ] . order ? children [ b ] . order : ''
262+ const idA = `${ orderA } ${ a . toUpperCase ( ) } `
263+ const idB = `${ orderB } ${ b . toUpperCase ( ) } `
264+ if ( idA < idB ) {
265+ return - 1
266+ }
267+ if ( idA > idB ) {
268+ return 1
269+ }
270+ return 0
271+ } )
272+ . map ( ( id ) => {
273+ if ( children [ id ] . section ) {
274+ return this . renderSectionLink (
275+ children [ id ] . id ,
276+ ( ) => {
277+ markExpanded ( sectionId )
278+ } ,
279+ 'category'
280+ )
281+ } else {
282+ return this . renderDocLink ( id )
283+ }
284+ } ) }
285+ </ ul >
286+ )
279287 }
280288
281289 renderSectionLink (
0 commit comments