import React from 'react';
import { Popover } from '@easyv/antd';
import styles from './DataTooltipPopover.less';
import DataTooltip from './DataTooltip';

interface DataTooltipProps {
  type: string;
  fields: {
    name: string;
    type: string;
    desc: string;
  }[];
  data: any;
  children: React.ReactNode;
}

export default function DataTooltipPopover({ children, type, fields = [], data = '' }: DataTooltipProps) {
  return (
    <Popover
      content={<DataTooltip type={type} fields={fields} data={data} />}
      title={null}
      trigger="click"
      placement="left"
      overlayClassName={styles.overlay}>
      {children}
    </Popover>
  );
}
