Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 4x 4x | import React, {ReactNode} from 'react';
import {Popconfirm, PopconfirmProps} from 'antd';
import scopedClasses from '../../utils/scopedClasses';
import './index.less';
const sc = scopedClasses('ll-popconfirm');
export interface LLPopconfirmProps extends PopconfirmProps {
description?: ReactNode;
}
const LLPopconfirm = (props: LLPopconfirmProps) => {
const {children, title, description, ...rest} = props;
const isolateTitle = (() => {
if (typeof title === 'function') {
return (
<div className={sc()}>
{title()}
<div className={sc('description')}>{description}</div>
</div>
);
}
return (
<div className={sc()}>
<div className={sc('title')}>{title}</div>
<div className={sc('description')}>{description}</div>
</div>
);
})();
return (
<Popconfirm title={isolateTitle} {...rest}>
{children}
</Popconfirm>
);
};
export default LLPopconfirm;
|