Skip to content

Commit

Permalink
Sort items by the order meta
Browse files Browse the repository at this point in the history
  • Loading branch information
schiehll committed May 26, 2019
1 parent bd58506 commit c8e911b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .kerbs/other.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const meta = {
title: 'Other'
title: 'Other',
order: 1
}

# Other
Expand Down
3 changes: 2 additions & 1 deletion .kerbs/overview.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Red from 'components/red'

export const meta = {
title: 'Overview with a big title'
title: 'Overview with a big title',
order: 0
}

# Overview
Expand Down
8 changes: 7 additions & 1 deletion src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ const Layout = () => {
id: 'id'
})
setKerbs(allKerbs.current)
setNavItems(navItems.concat(allKerbs.current))
setNavItems(
navItems.concat(
allKerbs.current.sort(
(a, b) => (a?.meta?.order || 0) - b?.meta?.order
)
)
)
}

loadKerbs()
Expand Down

0 comments on commit c8e911b

Please sign in to comment.