UNPKG

@uiw/react-popover

Version:

Popover component

80 lines 2.11 kB
import React, { useState } from 'react'; import Popover from './'; import "./style/index.css"; import Button from '@uiw/react-button'; import Icon from '@uiw/react-icon'; import { jsx as _jsx } from "react/jsx-runtime"; import { jsxs as _jsxs } from "react/jsx-runtime"; export default function Confirm(props) { var { trigger = 'click', placement = 'top', confirmText = 'Yes', title, cancelText = 'No', visibleArrow, children, onConfirm } = props; var [isOpen, setIsOpen] = useState(false); return /*#__PURE__*/_jsx(Popover, { isOpen: isOpen, visibleArrow: visibleArrow, content: /*#__PURE__*/_jsxs("div", { style: { padding: '12px 16px', position: 'relative' }, children: [/*#__PURE__*/_jsx(Icon, { type: "information", style: { position: 'absolute', top: 13.5, fontSize: 14, transform: 'rotate(180deg)', color: '#faad14' } }), /*#__PURE__*/_jsxs("div", { style: { paddingLeft: 20 }, children: [/*#__PURE__*/_jsx("div", { style: { fontSize: 14 }, children: title }), /*#__PURE__*/_jsxs("div", { style: { position: 'relative', bottom: 0, marginTop: 12, display: 'flex', justifyContent: 'end' }, children: [/*#__PURE__*/_jsx(Button, { size: "small", onClick: () => setIsOpen(false), children: cancelText }), /*#__PURE__*/_jsx(Button, { size: "small", type: "primary", style: { marginLeft: 10 }, onClick: () => { onConfirm == null || onConfirm(); setIsOpen(false); }, children: confirmText })] })] })] }), trigger: trigger, placement: placement, children: /*#__PURE__*/_jsx("div", { onClick: () => setIsOpen(true), children: children }) }); }