SidebarContents.tsx 1007 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import React from 'react';
  2. import { SidebarContentsType } from '~/interfaces/ui';
  3. import { useCurrentSidebarContents } from '~/stores/ui';
  4. // import CustomSidebar from './CustomSidebar';
  5. // import PageTree from './PageTree';
  6. import RecentChanges from './RecentChanges';
  7. import Tag from './Tag';
  8. const DummyComponent = (): JSX.Element => <></>; // Todo: remove this later when it is able to render other Contents.
  9. const SidebarContents = (): JSX.Element => {
  10. const { data: currentSidebarContents } = useCurrentSidebarContents();
  11. let Contents;
  12. switch (currentSidebarContents) {
  13. case SidebarContentsType.RECENT:
  14. Contents = RecentChanges;
  15. break;
  16. case SidebarContentsType.CUSTOM:
  17. // Contents = CustomSidebar;
  18. Contents = DummyComponent;
  19. break;
  20. case SidebarContentsType.TAG:
  21. Contents = Tag;
  22. break;
  23. default:
  24. // Contents = PageTree;
  25. Contents = DummyComponent;
  26. }
  27. return (
  28. <Contents />
  29. );
  30. };
  31. export default SidebarContents;