docs: improvement to sidebar (#11810)

* docs: improvement to sidebar

* fix sidebar
This commit is contained in:
Shahed Nasser authored and GitHub committed 2025-03-11 16:48:01 +02:00
1 parent e0277e375e
commit ef66ff8f99
3 files changed
+21 -14

No files matched your search

+11 -9
View File
@@ -1148,18 +1148,17 @@ export const generatedSidebars = [
"type": "link", "type": "link",
"path": "/learn/build", "path": "/learn/build",
"title": "Build", "title": "Build",
"chapterTitle": "8. Production", "children": [],
"children": [ "chapterTitle": "8.1. Build",
"number": "8.1."
},
{ {
"loaded": true, "loaded": true,
"isPathHref": true, "isPathHref": true,
"type": "link", "type": "link",
"path": "/learn/deployment", "path": "/learn/deployment",
"title": "Deployment Overview", "title": "Deployment Overview",
"children": [], "children": [
"chapterTitle": "8.1. Deployment Overview",
"number": "8.1."
},
{ {
"loaded": true, "loaded": true,
"isPathHref": true, "isPathHref": true,
@@ -1167,13 +1166,16 @@ export const generatedSidebars = [
"path": "/learn/deployment/general", "path": "/learn/deployment/general",
"title": "General Deployment", "title": "General Deployment",
"children": [], "children": [],
"chapterTitle": "8.2. General Deployment", "chapterTitle": "8.2.1. General Deployment",
"number": "8.2.1."
}
],
"chapterTitle": "8.2. Deployment Overview",
"number": "8.2." "number": "8.2."
} }
], ],
"chapterTitle": "8. Production",
"number": "8." "number": "8."
}
]
}, },
{ {
"loaded": true, "loaded": true,
+8 -3
View File
@@ -596,17 +596,20 @@ export const sidebars = [
}, },
], ],
}, },
{
type: "category",
title: "Production",
children: [
{ {
type: "link", type: "link",
path: "/learn/build", path: "/learn/build",
title: "Build", title: "Build",
chapterTitle: "Production", },
children: [
{ {
type: "link", type: "link",
path: "/learn/deployment", path: "/learn/deployment",
title: "Deployment Overview", title: "Deployment Overview",
}, children: [
{ {
type: "link", type: "link",
path: "/learn/deployment/general", path: "/learn/deployment/general",
@@ -614,6 +617,8 @@ export const sidebars = [
}, },
], ],
}, },
],
},
{ {
type: "category", type: "category",
title: "Upgrade", title: "Upgrade",
@@ -301,7 +301,7 @@ export const SidebarProvider = ({
}, [scrollableElement, isBrowser]) }, [scrollableElement, isBrowser])
const activeMainSidebar = useMemo(() => { const activeMainSidebar = useMemo(() => {
if (!activePath) { if (!activePath || sidebars.length === 1) {
// set first sidebar as active // set first sidebar as active
return sidebars[0] return sidebars[0]
} }
@@ -357,7 +357,7 @@ export const SidebarProvider = ({
const shownSidebar = useMemo(() => { const shownSidebar = useMemo(() => {
if (!sidebarHistory.length) { if (!sidebarHistory.length) {
return return sidebars.length === 1 ? sidebars[0] : undefined
} }
return getSidebar(sidebarHistory[sidebarHistory.length - 1]) return getSidebar(sidebarHistory[sidebarHistory.length - 1])