ComplexDataHoverView.tsx 839 B

123456789101112131415161718192021222324252627282930
  1. import React, { useState } from 'react';
  2. import { CloseButton } from 'app/core/components/CloseButton/CloseButton';
  3. import { GeomapLayerHover } from '../event';
  4. import { DataHoverRows } from './DataHoverRows';
  5. import { DataHoverTabs } from './DataHoverTabs';
  6. export interface Props {
  7. layers?: GeomapLayerHover[];
  8. isOpen: boolean;
  9. onClose: () => void;
  10. }
  11. export const ComplexDataHoverView = ({ layers, onClose, isOpen }: Props) => {
  12. const [activeTabIndex, setActiveTabIndex] = useState<number>(0);
  13. if (!layers) {
  14. return null;
  15. }
  16. return (
  17. <>
  18. {isOpen && <CloseButton style={{ zIndex: 1 }} onClick={onClose} />}
  19. <DataHoverTabs layers={layers} setActiveTabIndex={setActiveTabIndex} activeTabIndex={activeTabIndex} />
  20. <DataHoverRows layers={layers} activeTabIndex={activeTabIndex} />
  21. </>
  22. );
  23. };