/*
checkList = [{label: "con", value: "con"}];
defaultChecked=[{label: "con", value: "con"}];
*/
import React from 'react';
import { Popconfirm, Button } from 'antd';



function ConfirmButton(props) {
  const {isConfirm=true, onClick, type, icon,size,disabled,key,title,confirmTitle,style} = props;
  const isRow=size==='small';
  return (
    isConfirm&&!disabled ?
      <Popconfirm title={confirmTitle?confirmTitle:"是否确认执行?"} onConfirm={onClick} key={key}>
        {
          isRow ?
            <Button type={type} icon={icon} disabled={disabled} size={'small'} title={title} style={style} /> :
            <Button type={type} icon={icon} disabled={disabled}  style={style} >{title}</Button>
        }
      </Popconfirm> :
      isRow ?
        <Button type={type} icon={icon} disabled={disabled}  onClick={onClick} size={'small'} title={title} style={style} /> :
        <Button type={type} icon={icon} disabled={disabled}  onClick={onClick} style={style} >{title}</Button>
  );
}
export default ConfirmButton;

