SidebarContents.tsx 846 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import React, { FC } from 'react';
  2. import { SidebarContentsType } from '~/interfaces/ui';
  3. import { useCurrentSidebarContents } from '~/stores/ui';
  4. import RecentChanges from './RecentChanges';
  5. import CustomSidebar from './CustomSidebar';
  6. import PageTree from './PageTree';
  7. import Tag from './Tag';
  8. type Props = {
  9. };
  10. const SidebarContents: FC<Props> = (props: Props) => {
  11. const { data: currentSidebarContents } = useCurrentSidebarContents();
  12. let Contents;
  13. switch (currentSidebarContents) {
  14. case SidebarContentsType.RECENT:
  15. Contents = RecentChanges;
  16. break;
  17. case SidebarContentsType.CUSTOM:
  18. Contents = CustomSidebar;
  19. break;
  20. case SidebarContentsType.TAG:
  21. Contents = Tag;
  22. break;
  23. default:
  24. Contents = PageTree;
  25. }
  26. return (
  27. <Contents />
  28. );
  29. };
  30. export default SidebarContents;