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 color: green
icon: stroke_decentralization icon: stroke_decentralization
description: Dash Platorm Documentation resources. description: Dash Platorm Documentation resources.
weight: 10
content: content:
- title: DashJS - title: DashJS
website: https://dashevo.github.io/DashJS website: https://dashevo.github.io/DashJS

View file

@ -2,6 +2,7 @@ title: Tools
color: yellow color: yellow
icon: stroke_code icon: stroke_code
description: Tools for developing with Dash Platform. description: Tools for developing with Dash Platform.
weight: 6
content: content:
- title: EvoNet Faucet - title: EvoNet Faucet
website: http://devnet-evonet-1117662964.us-west-2.elb.amazonaws.com/ 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.slug = slugify(file.title)
file.type = 'category' file.type = 'category'
file.content = file.content.map(({ title, description, ...meta }, i) => ({ file.content = file.content.map(({ title, description, weight, ...meta }, i) => ({
...meta, ...meta,
title: trimIfExists(title), title: trimIfExists(title),
description: trimIfExists(description), description: trimIfExists(description),
weight: weight,
category: file.slug, category: file.slug,
color: file.color, color: file.color,
index: i index: i
@ -32,3 +33,4 @@ module.exports = fs.readdirSync(dir)
return file return file
}) })
.sort((a, b) => sortAbc(a.title, b.title)) .sort((a, b) => sortAbc(a.title, b.title))
.sort((a, b) => sortInv(a.weight, b.weight))