fix(studio): Remove submenus from account measurements sets and patterns. (#355)
Reviewed-on: https://codeberg.org/freesewing/freesewing/pulls/355 Reviewed-by: Joost De Cock <joostdecock@noreply.codeberg.org> Co-authored-by: Benjamin Fan <benjamesben@noreply.codeberg.org> Co-committed-by: Benjamin Fan <benjamesben@noreply.codeberg.org>
This commit is contained in:
parent
094863c993
commit
7c796a689e
1 changed files with 23 additions and 0 deletions
|
@ -2,6 +2,25 @@ import { themes as prismThemes } from 'prism-react-renderer'
|
|||
import { docusaurusPlugins } from './plugins/index.mjs'
|
||||
import smartypants from 'remark-smartypants'
|
||||
|
||||
function customizeSidebar(items) {
|
||||
// Filter out submenus in Your Measurements Sets and Your Patterns
|
||||
for (const item in items) {
|
||||
if (items[item].label === 'Account') {
|
||||
for (const design in items[item].items) {
|
||||
for (const subpage in items[item].items[design].items) {
|
||||
if (
|
||||
items[item].items[design].items[subpage].label === 'Your Measurements Sets' ||
|
||||
items[item].items[design].items[subpage].label === 'Your Patterns'
|
||||
) {
|
||||
items[item].items[design].items[subpage].items = []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
const config = {
|
||||
title: 'FreeSewing Studio',
|
||||
tagline: 'FreeSewing for Designers',
|
||||
|
@ -28,6 +47,10 @@ const config = {
|
|||
docs: {
|
||||
routeBasePath: '/',
|
||||
sidebarPath: './sidebars.js',
|
||||
async sidebarItemsGenerator({ defaultSidebarItemsGenerator, ...args }) {
|
||||
const sidebarItems = await defaultSidebarItemsGenerator(args)
|
||||
return customizeSidebar(sidebarItems)
|
||||
},
|
||||
remarkPlugins: [[smartypants, { dashes: 'oldschool' }]],
|
||||
},
|
||||
theme: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue