import { h } from "vue";
import { ElButton, ElPopover } from "element-plus";
import { useRenderIcon } from "/@/components/ReIcon/src/hooks";

export function createTooltip(left: string, reference: string, width = 200, placement = 'top') {
  return h(
    "span",
    {},
    {
      default: () => [
        h(
          ElPopover,
          {
            placement,
            content: reference,
            width
          },
          {
            reference: () =>
              h(ElButton, {
                link: true,
                icon: useRenderIcon("information-line")
              })
          }
        ),
        left
      ]
    }
  );
}
