CustomTabContent.tsx 947 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import React from 'react';
  2. import {
  3. TabContent, TabPane,
  4. } from 'reactstrap';
  5. import type { ICustomNavTabMappings } from '~/interfaces/ui';
  6. import { LazyRenderer } from '../Common/LazyRenderer';
  7. type Props = {
  8. activeTab: string,
  9. navTabMapping: ICustomNavTabMappings,
  10. additionalClassNames?: string[],
  11. }
  12. const CustomTabContent = (props: Props): JSX.Element => {
  13. const { activeTab, navTabMapping, additionalClassNames } = props;
  14. return (
  15. <TabContent activeTab={activeTab} className={additionalClassNames != null ? additionalClassNames.join(' ') : ''}>
  16. {Object.entries(navTabMapping).map(([key, value]) => {
  17. const { Content } = value;
  18. return (
  19. <TabPane key={key} tabId={key}>
  20. <LazyRenderer shouldRender={key === activeTab}>
  21. <Content />
  22. </LazyRenderer>
  23. </TabPane>
  24. );
  25. })}
  26. </TabContent>
  27. );
  28. };
  29. export default CustomTabContent;