SidebarContents.tsx 750 B

123456789101112131415161718192021222324252627282930313233
  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. type Props = {
  8. };
  9. const SidebarContents: FC<Props> = (props: Props) => {
  10. const { data: currentSidebarContents } = useCurrentSidebarContents();
  11. let Contents;
  12. switch (currentSidebarContents) {
  13. case SidebarContentsType.RECENT:
  14. Contents = RecentChanges;
  15. break;
  16. case SidebarContentsType.TREE:
  17. Contents = PageTree;
  18. break;
  19. default:
  20. Contents = CustomSidebar;
  21. }
  22. return (
  23. <Contents />
  24. );
  25. };
  26. export default SidebarContents;