Skip to content

Commit dc4cbc8

Browse files
author
Hui
committed
[popover]修改样式
1 parent b281944 commit dc4cbc8

1 file changed

Lines changed: 28 additions & 11 deletions

File tree

src/components/popover/index.js

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ function Popover(props) {
3636

3737
const ref = createRef();
3838

39-
const closeTooltipExec = (evtPath) => evtPath.find((ele) => (
40-
ele.classList
39+
const closeTooltipExec = (evtPath) => evtPath.find(
40+
(ele) => ele.classList
4141
&& ele.classList.contains
4242
&& (ele.classList.contains(cancelBtnClass)
4343
|| ele.classList.contains(confirmBtnClass)
44-
|| ele.classList.contains(closeIconClass))
45-
));
44+
|| ele.classList.contains(closeIconClass)),
45+
);
4646

4747
const handleCancelClick = () => {
4848
props.onCancelClick();
@@ -61,7 +61,13 @@ function Popover(props) {
6161
const handleConfirmClick = async () => {
6262
const isInvalidate = props.onConfirmClick();
6363
if (isInvalidate && isInvalidate.then) {
64-
isInvalidate.then((res) => { removeClass(res); }).catch(() => { removeClass(true); });
64+
isInvalidate
65+
.then((res) => {
66+
removeClass(res);
67+
})
68+
.catch(() => {
69+
removeClass(true);
70+
});
6571
return;
6672
}
6773
removeClass(isInvalidate);
@@ -74,13 +80,17 @@ function Popover(props) {
7480
popoverContent = (
7581
<div className={classSelector}>
7682
<section className={`${classSelector}-content`}>
77-
{showIcon && (iconTpl || <Icon className={`${classSelector}-icon`} type="info_1" />)}
83+
{showIcon
84+
&& (iconTpl || (
85+
<Icon className={`${classSelector}-icon`} type="info_1" />
86+
))}
7887

7988
<div className={`${classSelector}-main-content`}>
8089
{title && <p className={`${classSelector}-title`}>{title}</p>}
8190
{content && (
8291
<p
83-
className={`${classSelector}-desc ${title ? `${classSelector}-has-title` : ''
92+
className={`${classSelector}-desc ${
93+
title ? `${classSelector}-has-title` : ''
8494
}`}
8595
>
8696
{content}
@@ -91,7 +101,12 @@ function Popover(props) {
91101

92102
<section className={`${classSelector}-btn`} ref={ref}>
93103
{showCancelBtn && (
94-
<Button onClick={handleCancelClick} size="small" className={cancelBtnClass} {...cancelBtnOpts}>
104+
<Button
105+
onClick={handleCancelClick}
106+
size="small"
107+
className={cancelBtnClass}
108+
{...cancelBtnOpts}
109+
>
95110
{cancelBtnText}
96111
</Button>
97112
)}
@@ -131,9 +146,11 @@ function Popover(props) {
131146
onVisibleChange={onVisibleChange}
132147
className={classnames(className, {
133148
[`${classSelector}-tooltip-${size}`]:
134-
title || showCancelBtn || showConfirmBtn,
149+
title || showCancelBtn || showConfirmBtn,
135150
})}
136-
overlayStyle={{ width, maxWidth: width }}
151+
overlayStyle={{
152+
width, maxWidth: width, maxHeight: 280, padding: 12,
153+
}}
137154
{...otherProps}
138155
>
139156
{children}
@@ -169,7 +186,7 @@ Popover.defaultProps = {
169186
showCancelBtn: false,
170187
showConfirmBtn: false,
171188
cancelBtnText: '取消',
172-
confirmText: '确认',
189+
confirmText: '确定',
173190
size: 'default',
174191
type: 'default',
175192
onCancelClick: noop,

0 commit comments

Comments
 (0)