feat(nav): Enable top nav manual ordering

Add the "weight" parameter to categories
Add sorting code to data.js to sort by the new parameter
This commit is contained in:
Joshua Seigler 2020-03-11 10:19:41 -04:00
parent 324b792dae
commit ce3f23e52d
3 changed files with 5 additions and 1 deletions

View file

@ -2,6 +2,7 @@ title: Docs
color: green
icon: stroke_decentralization
description: Dash Platorm Documentation resources.
weight: 10
content:
- title: DashJS
website: https://dashevo.github.io/DashJS

View file

@ -2,6 +2,7 @@ title: Tools
color: yellow
icon: stroke_code
description: Tools for developing with Dash Platform.
weight: 6
content:
- title: EvoNet Faucet
website: http://devnet-evonet-1117662964.us-west-2.elb.amazonaws.com/

View file

@ -13,10 +13,11 @@ module.exports = fs.readdirSync(dir)
file.slug = slugify(file.title)
file.type = 'category'
file.content = file.content.map(({ title, description, ...meta }, i) => ({
file.content = file.content.map(({ title, description, weight, ...meta }, i) => ({
...meta,
title: trimIfExists(title),
description: trimIfExists(description),
weight: weight,
category: file.slug,
color: file.color,
index: i
@ -32,3 +33,4 @@ module.exports = fs.readdirSync(dir)
return file
})
.sort((a, b) => sortAbc(a.title, b.title))
.sort((a, b) => sortInv(a.weight, b.weight))