-
-
Notifications
You must be signed in to change notification settings - Fork 112
feat: adapt semantic close #455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,23 @@ | ||
| import classnames from 'classnames'; | ||
| import * as React from 'react'; | ||
|
|
||
| export interface CloseBtnProps { | ||
| prefixCls: string; | ||
| icon?: React.ReactNode; | ||
| onClick: React.MouseEventHandler<HTMLButtonElement>; | ||
| className?: string; | ||
| style?: React.CSSProperties; | ||
| } | ||
|
|
||
| export default function CloseBtn(props: CloseBtnProps) { | ||
| const { prefixCls, icon, onClick } = props; | ||
| const { prefixCls, icon, onClick, className, style } = props; | ||
|
|
||
| return ( | ||
| <button className={`${prefixCls}-close`} onClick={onClick}> | ||
| <button | ||
| className={classnames(`${prefixCls}-close`, className)} | ||
| style={style} | ||
| onClick={onClick} | ||
| > | ||
| {icon} | ||
| </button> | ||
|
Comment on lines
16
to
22
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a good practice to explicitly set the |
||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ import PrevNext from './PrevNext'; | |
|
|
||
| // Note: if you want to add `action`, | ||
| // pls contact @zombieJ or @thinkasany first. | ||
| export type PreviewSemanticName = 'root' | 'mask' | 'body' | FooterSemanticName; | ||
| export type PreviewSemanticName = 'root' | 'mask' | 'body' | 'close' | FooterSemanticName; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 补一下测试用例 |
||
|
|
||
| export interface OperationIcons { | ||
| rotateLeft?: React.ReactNode; | ||
|
|
@@ -440,6 +440,8 @@ const Preview: React.FC<PreviewProps> = props => { | |
| prefixCls={prefixCls} | ||
| icon={closeIcon === true ? icons.close : closeIcon || icons.close} | ||
| onClick={onClose} | ||
| className={classNames.close} | ||
| style={styles.close} | ||
| /> | ||
| )} | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
classNames 这个库已经删掉了