export function getJsxStatus(className, content) {
  let statusClass = "txt-status";
  if (className) statusClass = statusClass + ' ' + className;
  let h = window.$vueRoot.$createElement;
  let node = h('div', {staticClass: statusClass}, content)
  return [node];
}

export function getJsxBtn({iconName, content, showContent,show, onclick}) {
  if(show===false){
    return [];
  }
  let h = window.$vueRoot.$createElement;
  let contentNodes = [h("i", {staticClass: iconName})]
  if (showContent) {
    contentNodes.push(h('span', {}, content));
  }
  return [h("a", {
    staticClass: "a-link",
    on: {
      click: (event) => {
        onclick && onclick(event);
      }
    }
  }, [
    h("el-tooltip", {
      attrs: {
        enterable: false,
        effect: "dark",
        content: content,
        placement: "top",
        "popper-class": "tooltip-skin"
      }
    }, [
      h("div", {}, contentNodes)
    ])
  ])]
}

export function getJsxLink({content, onclick}) {
  let h = window.$vueRoot.$createElement;
  return [h("a", {
    on: {
      click: (event) => {
        onclick && onclick(event);
      }
    }
  }, content)]
}

export function getJsxBtnList(list) {
  let arr = [];
  list.forEach(item => {
    arr.push(...getJsxBtn(item));
  })
  let h = window.$vueRoot.$createElement;
  return [
    h('div', {}, arr)
  ];
}
