2020-12-03 10:30:05 +08:00
|
|
|
import { entries, sortBy } from 'lodash'
|
|
|
|
import nav from '../assets/data/nav.json'
|
|
|
|
|
2021-08-23 19:37:43 +08:00
|
|
|
export default entries(nav).reduce((ret, [lang, items]) => {
|
|
|
|
ret[lang] = items.map(item => {
|
2020-12-03 10:30:05 +08:00
|
|
|
if (!item.children) {
|
|
|
|
return item
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
...item,
|
2021-08-23 19:37:43 +08:00
|
|
|
children:
|
|
|
|
item.slug === 'components'
|
|
|
|
? sortBy(item.children, child => child.title)
|
|
|
|
: item.children
|
2020-12-03 10:30:05 +08:00
|
|
|
}
|
|
|
|
})
|
|
|
|
return ret
|
|
|
|
}, {})
|