separate community/blog sidebars

This commit is contained in:
Dan Abramov
2023-02-05 17:20:51 +00:00
parent 3bb6effa2a
commit 5043bb3a56
4 changed files with 95 additions and 73 deletions

View File

@@ -8,6 +8,8 @@ import {MDXComponents} from 'components/MDX/MDXComponents';
import {Page} from 'components/Layout/Page';
import sidebarLearn from '../sidebarLearn.json';
import sidebarReference from '../sidebarReference.json';
import sidebarCommunity from '../sidebarCommunity.json';
import sidebarBlog from '../sidebarBlog.json';
export default function Layout({content, toc, meta}) {
const parsedContent = useMemo(
@@ -21,6 +23,12 @@ export default function Layout({content, toc, meta}) {
case 'reference':
routeTree = sidebarReference;
break;
case 'community':
routeTree = sidebarCommunity;
break;
case 'blog':
routeTree = sidebarBlog;
break;
}
return (
<Page toc={parsedToc} routeTree={routeTree} meta={meta} section={section}>
@@ -35,8 +43,10 @@ function useActiveSection() {
return 'reference';
} else if (asPath.startsWith('/learn')) {
return 'learn';
} else if (asPath.startsWith('/community')) {
return 'community';
} else if (asPath.startsWith('/blog')) {
return 'learn';
return 'blog';
} else {
return 'home';
}

42
beta/src/sidebarBlog.json Normal file
View File

@@ -0,0 +1,42 @@
{
"routes": [
{
"hasSectionHeader": true,
"sectionHeader": "Stay Informed"
},
{
"title": "Blog",
"path": "/blog",
"routes": [
{
"title": "React Labs: June 2022",
"path": "/blog/2022/06/15/react-labs-what-we-have-been-working-on-june-2022"
},
{
"title": "React v18.0",
"path": "/blog/2022/03/29/react-v18"
},
{
"title": "How to Upgrade to React 18",
"path": "/blog/2022/03/08/react-18-upgrade-guide"
},
{
"title": "React Conf 2021 Recap",
"path": "/blog/2021/12/17/react-conf-2021-recap"
},
{
"title": "The Plan for React 18",
"path": "/blog/2021/06/08/the-plan-for-react-18"
},
{
"title": "Introducing Server Components",
"path": "/blog/2020/12/21/data-fetching-with-react-server-components"
},
{
"title": "Older posts",
"path": "https://reactjs.org/blog/all.html"
}
]
}
]
}

View File

@@ -0,0 +1,42 @@
{
"routes": [
{
"hasSectionHeader": true,
"sectionHeader": "Get Involved"
},
{
"title": "Community",
"path": "/community",
"routes": [
{
"title": "React Conferences",
"path": "/community/conferences"
},
{
"title": "React Meetups",
"path": "/community/meetups"
},
{
"title": "React Videos",
"path": "/community/videos"
},
{
"title": "Meet the Team",
"path": "/community/team"
},
{
"title": "Docs Contributors",
"path": "/community/docs-contributors"
},
{
"title": "Acknowledgements",
"path": "/community/acknowledgements"
},
{
"title": "Versioning Policy",
"path": "/community/versioning-policy"
}
]
}
]
}

View File

@@ -198,78 +198,6 @@
"path": "/learn/reusing-logic-with-custom-hooks"
}
]
},
{
"hasSectionHeader": true,
"sectionHeader": "About React"
},
{
"title": "Community",
"path": "/community",
"routes": [
{
"title": "React Conferences",
"path": "/community/conferences"
},
{
"title": "React Meetups",
"path": "/community/meetups"
},
{
"title": "React Videos",
"path": "/community/videos"
},
{
"title": "Meet the Team",
"path": "/community/team"
},
{
"title": "Docs Contributors",
"path": "/community/docs-contributors"
},
{
"title": "Acknowledgements",
"path": "/community/acknowledgements"
},
{
"title": "Versioning Policy",
"path": "/community/versioning-policy"
}
]
},
{
"title": "Blog",
"path": "/blog",
"routes": [
{
"title": "React Labs: June 2022",
"path": "/blog/2022/06/15/react-labs-what-we-have-been-working-on-june-2022"
},
{
"title": "React v18.0",
"path": "/blog/2022/03/29/react-v18"
},
{
"title": "How to Upgrade to React 18",
"path": "/blog/2022/03/08/react-18-upgrade-guide"
},
{
"title": "React Conf 2021 Recap",
"path": "/blog/2021/12/17/react-conf-2021-recap"
},
{
"title": "The Plan for React 18",
"path": "/blog/2021/06/08/the-plan-for-react-18"
},
{
"title": "Introducing Server Components",
"path": "/blog/2020/12/21/data-fetching-with-react-server-components"
},
{
"title": "Older posts",
"path": "https://reactjs.org/blog/all.html"
}
]
}
]
}