/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import React, {memo, type ReactNode} from 'react'; import {useThemeConfig} from '@docusaurus/theme-common'; import {groupBlogSidebarItemsByYear} from '@docusaurus/plugin-content-blog/client'; import Heading from '@theme/Heading'; import type {Props} from '@theme/BlogSidebar/Content'; function BlogSidebarYearGroup({ year, yearGroupHeadingClassName, children, }: { year: string; yearGroupHeadingClassName?: string; children: ReactNode; }) { return (
{year} {children}
); } function BlogSidebarContent({ items, yearGroupHeadingClassName, ListComponent, }: Props): ReactNode { const themeConfig = useThemeConfig(); if (themeConfig.blog.sidebar.groupByYear) { const itemsByYear = groupBlogSidebarItemsByYear(items); return ( <> {itemsByYear.map(([year, yearItems]) => ( ))} ); } else { return ; } } export default memo(BlogSidebarContent);