Skip to content

Commit 82898fd

Browse files
committed
feat: adapt semantic close
1 parent 607cb16 commit 82898fd

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/Preview/CloseBtn.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1+
import classnames from 'classnames';
12
import * as React from 'react';
23

34
export interface CloseBtnProps {
45
prefixCls: string;
56
icon?: React.ReactNode;
67
onClick: React.MouseEventHandler<HTMLButtonElement>;
8+
className?: string;
9+
style?: React.CSSProperties;
710
}
811

912
export default function CloseBtn(props: CloseBtnProps) {
10-
const { prefixCls, icon, onClick } = props;
13+
const { prefixCls, icon, onClick, className, style } = props;
1114

1215
return (
13-
<button className={`${prefixCls}-close`} onClick={onClick}>
16+
<button
17+
className={classnames(`${prefixCls}-close`, className)}
18+
style={style}
19+
onClick={onClick}
20+
>
1421
{icon}
1522
</button>
1623
);

src/Preview/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import PrevNext from './PrevNext';
1919

2020
// Note: if you want to add `action`,
2121
// pls contact @zombieJ or @thinkasany first.
22-
export type PreviewSemanticName = 'root' | 'mask' | 'body' | FooterSemanticName;
22+
export type PreviewSemanticName = 'root' | 'mask' | 'body' | 'close' | FooterSemanticName;
2323

2424
export interface OperationIcons {
2525
rotateLeft?: React.ReactNode;
@@ -440,6 +440,8 @@ const Preview: React.FC<PreviewProps> = props => {
440440
prefixCls={prefixCls}
441441
icon={closeIcon === true ? icons.close : closeIcon || icons.close}
442442
onClick={onClose}
443+
className={classNames.close}
444+
style={styles.close}
443445
/>
444446
)}
445447

0 commit comments

Comments
 (0)