Blame view

src/components/ButtomConfirm/index.tsx 693 Bytes
sanmu authored
1
import { Button, Popconfirm } from 'antd';
zhongnanhuang authored
2
import { TooltipPlacement } from 'antd/lib/tooltip';
sanmu authored
3
4
5
6
7
8
9

const ButtonConfirm = ({
  title,
  description,
  text,
  className,
  onConfirm,
zhongnanhuang authored
10
  placement,
sanmu authored
11
12
13
14
15
16
}: {
  title: string;
  text: string;
  description?: string;
  className?: string;
  onConfirm?: () => void;
zhongnanhuang authored
17
  placement?: TooltipPlacement;
sanmu authored
18
19
20
}) => {
  return (
    <Popconfirm
zhongnanhuang authored
21
      placement={placement ? placement : 'topLeft'}
sanmu authored
22
23
24
25
26
27
28
29
30
31
32
33
34
35
      title={title}
      description={description}
      onConfirm={onConfirm}
      okText="确认"
      cancelText="取消"
    >
      <Button type="link" className={className}>
        {text}
      </Button>
    </Popconfirm>
  );
};

export default ButtonConfirm;