docusaurus/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/index.tsx
2022-03-25 18:59:31 +01:00

27 lines
832 B
TypeScript

/**
* 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 from 'react';
import DocSidebarItemCategory from '@theme/DocSidebarItem/Category';
import DocSidebarItemLink from '@theme/DocSidebarItem/Link';
import DocSidebarItemHtml from '@theme/DocSidebarItem/Html';
import type {Props} from '@theme/DocSidebarItem';
export default function DocSidebarItem({
item,
...props
}: Props): JSX.Element | null {
switch (item.type) {
case 'category':
return <DocSidebarItemCategory item={item} {...props} />;
case 'html':
return <DocSidebarItemHtml item={item} {...props} />;
case 'link':
default:
return <DocSidebarItemLink item={item} {...props} />;
}
}