From dd625b7b5c3932c31bd2c4df48cf96009477fba8 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Sun, 5 Feb 2023 21:59:15 +0000 Subject: [PATCH] default sidebar --- beta/src/content/blog/index.md | 2 +- beta/src/content/community/index.md | 2 +- beta/src/pages/[[...markdownPath]].js | 9 ++- beta/src/sidebarBlog.json | 2 +- beta/src/sidebarCommunity.json | 2 +- beta/src/sidebarHome.json | 94 +++++++++++++++++++++++++++ 6 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 beta/src/sidebarHome.json diff --git a/beta/src/content/blog/index.md b/beta/src/content/blog/index.md index 2508456f8..c527417fa 100644 --- a/beta/src/content/blog/index.md +++ b/beta/src/content/blog/index.md @@ -1,5 +1,5 @@ --- -title: Blog +title: React Blog --- diff --git a/beta/src/content/community/index.md b/beta/src/content/community/index.md index 75b42251a..1e28a27f0 100644 --- a/beta/src/content/community/index.md +++ b/beta/src/content/community/index.md @@ -1,5 +1,5 @@ --- -title: Community +title: React Community --- diff --git a/beta/src/pages/[[...markdownPath]].js b/beta/src/pages/[[...markdownPath]].js index 59bb2201f..2af78a68d 100644 --- a/beta/src/pages/[[...markdownPath]].js +++ b/beta/src/pages/[[...markdownPath]].js @@ -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; diff --git a/beta/src/sidebarBlog.json b/beta/src/sidebarBlog.json index a709a7a8c..9475c2a78 100644 --- a/beta/src/sidebarBlog.json +++ b/beta/src/sidebarBlog.json @@ -1,5 +1,5 @@ { - "title": "React Blog", + "title": "Blog", "path": "/blog", "routes": [ { diff --git a/beta/src/sidebarCommunity.json b/beta/src/sidebarCommunity.json index f43e01840..607165a16 100644 --- a/beta/src/sidebarCommunity.json +++ b/beta/src/sidebarCommunity.json @@ -1,5 +1,5 @@ { - "title": "React Community", + "title": "Community", "path": "/community", "routes": [ { diff --git a/beta/src/sidebarHome.json b/beta/src/sidebarHome.json new file mode 100644 index 000000000..d14ae4ce5 --- /dev/null +++ b/beta/src/sidebarHome.json @@ -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" + } + ] +}