default sidebar

This commit is contained in:
Dan Abramov
2023-02-05 21:59:15 +00:00
parent ec605ec033
commit dd625b7b5c
6 changed files with 106 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
---
title: Blog
title: React Blog
---
<Intro>

View File

@@ -1,5 +1,5 @@
---
title: Community
title: React Community
---
<Intro>

View File

@@ -6,6 +6,7 @@ import {Fragment, useMemo} from 'react';
import {useRouter} from 'next/router';
import {MDXComponents} from 'components/MDX/MDXComponents';
import {Page} from 'components/Layout/Page';
import sidebarHome from '../sidebarHome.json';
import sidebarLearn from '../sidebarLearn.json';
import sidebarReference from '../sidebarReference.json';
import sidebarCommunity from '../sidebarCommunity.json';
@@ -18,8 +19,14 @@ export default function Layout({content, toc, meta}) {
);
const parsedToc = useMemo(() => JSON.parse(toc, reviveNodeOnClient), [toc]);
const section = useActiveSection();
let routeTree = sidebarLearn;
let routeTree;
switch (section) {
case 'home':
routeTree = sidebarHome;
break;
case 'learn':
routeTree = sidebarLearn;
break;
case 'reference':
routeTree = sidebarReference;
break;

View File

@@ -1,5 +1,5 @@
{
"title": "React Blog",
"title": "Blog",
"path": "/blog",
"routes": [
{

View File

@@ -1,5 +1,5 @@
{
"title": "React Community",
"title": "Community",
"path": "/community",
"routes": [
{

94
beta/src/sidebarHome.json Normal file
View File

@@ -0,0 +1,94 @@
{
"title": "React Docs",
"path": "/",
"routes": [
{
"hasSectionHeader": true,
"sectionHeader": "Get Started"
},
{
"title": "Installation",
"path": "/learn/installation"
},
{
"title": "Quick Start",
"path": "/learn"
},
{
"hasSectionHeader": true,
"sectionHeader": "Learn React"
},
{
"title": "Describing the UI",
"path": "/learn/describing-the-ui"
},
{
"title": "Adding Interactivity",
"path": "/learn/adding-interactivity"
},
{
"title": "Managing State",
"path": "/learn/managing-state"
},
{
"title": "Escape Hatches",
"path": "/learn/escape-hatches"
},
{
"hasSectionHeader": true,
"sectionHeader": "Reference (react)"
},
{
"title": "Components",
"path": "/reference/react/components"
},
{
"title": "Hooks",
"path": "/reference/react"
},
{
"title": "APIs",
"path": "/reference/react/apis"
},
{
"title": "Legacy APIs",
"path": "/reference/react/legacy"
},
{
"hasSectionHeader": true,
"sectionHeader": "Reference (react-dom)"
},
{
"title": "Components",
"path": "/reference/react-dom/components"
},
{
"title": "APIs",
"path": "/reference/react-dom"
},
{
"title": "Client APIs",
"path": "/reference/react-dom/client"
},
{
"title": "Server APIs",
"path": "/reference/react-dom/server"
},
{
"hasSectionHeader": true,
"sectionHeader": "Get Involved"
},
{
"title": "React Community",
"path": "/community"
},
{
"hasSectionHeader": true,
"sectionHeader": "Stay Informed"
},
{
"title": "React Blog",
"path": "/blog"
}
]
}