Skip to content

Commit

Permalink
fix(modal): fix buttonProps.style covered (#1881)
Browse files Browse the repository at this point in the history
* fix(drawer): fix console wrong

* fix(modal): fix buttonProps.style covered

Co-authored-by: maxin <maxin@growingio.com>
  • Loading branch information
nnmax and maxin committed Mar 3, 2022
1 parent fc506e1 commit aa778ca
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 25 deletions.
9 changes: 1 addition & 8 deletions src/drawer/drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import classnames from 'classnames';
import { usePrefixCls } from '@gio-design/utils';
import RcDialog from 'rc-dialog';
import { CloseOutlined } from '@gio-design/icons';
import { IconButton } from '../button';
import { DrawerProps } from './interfaces';

export const Drawer: React.FC<DrawerProps> = ({
Expand Down Expand Up @@ -43,13 +42,7 @@ export const Drawer: React.FC<DrawerProps> = ({
className={drawerCls}
wrapClassName={wrapperCls}
closable={title !== false}
closeIcon={
closeIcon || (
<IconButton type="text" size="small">
<CloseOutlined className={closeCls} />
</IconButton>
)
}
closeIcon={closeIcon || <CloseOutlined className={closeCls} />}
title={title}
width={size === 'fixed' ? 500 : width}
{...restProps}
Expand Down
2 changes: 1 addition & 1 deletion src/drawer/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
position: absolute;
top: 20px;
right: 20px;
z-index: 1;
display: inline-flex;
align-items: center;
justify-content: center;
Expand All @@ -116,7 +117,6 @@
color: @gray-5;
background-color: @gray-0;
border: 0;
border-radius: 50%;
outline: 0;
cursor: pointer;
}
Expand Down
31 changes: 16 additions & 15 deletions src/modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import classnames from 'classnames';
import { useLocale, usePrefixCls } from '@gio-design/utils';
import RcDialog from 'rc-dialog';
import { CloseOutlined } from '@gio-design/icons';
import Button, { IconButton } from '../button';
import { omit } from 'lodash';
import Button from '../button';
import { ModalProps } from './interface';
import defaultLocale from '../locales/zh-CN';

Expand Down Expand Up @@ -44,21 +45,27 @@ const Modal: React.FC<ModalProps> = ({
<div>
<Button
type="secondary"
{...closeButtonProps}
style={{ padding: '7px 13px' }}
style={{ padding: '7px 13px', ...closeButtonProps?.style }}
className={closeBtnCls}
onClick={onClose}
onClick={(e) => {
onClose?.(e);
closeButtonProps?.onClick?.(e);
}}
{...omit(closeButtonProps, 'style', 'className', 'onClick')}
>
{customizeCloseText ?? closeText ?? '取消'}
</Button>
{useOkBtn && (
<Button
type="primary"
{...okButtonProps}
loading={confirmLoading}
loading={confirmLoading ?? okButtonProps?.loading}
className={okBtnCls}
style={{ padding: '7px 13px' }}
onClick={onOk}
style={{ padding: '7px 13px', ...okButtonProps?.style }}
onClick={(e) => {
onOk?.(e);
okButtonProps?.onClick?.(e);
}}
{...omit(okButtonProps, 'style', 'onClick', 'className', 'loading')}
>
{customizeOKText ?? okText ?? '确定'}
</Button>
Expand All @@ -84,13 +91,7 @@ const Modal: React.FC<ModalProps> = ({
className={modalCls}
wrapClassName={wrapperCls}
closable={title !== false}
closeIcon={
closeIcon || (
<IconButton type="text" size="small">
<CloseOutlined className={closeCls} />
</IconButton>
)
}
closeIcon={closeIcon || <CloseOutlined className={closeCls} />}
title={title}
footer={renderDefaultFooter()}
{...restProps}
Expand Down
2 changes: 1 addition & 1 deletion src/modal/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
position: absolute;
top: 16px;
right: 20px;
z-index: 1;
display: inline-flex;
align-items: center;
justify-content: center;
Expand All @@ -126,7 +127,6 @@
color: @gray-5;
background-color: @gray-0;
border: 0;
border-radius: 50%;
outline: 0;
cursor: pointer;
}
Expand Down

1 comment on commit aa778ca

@vercel
Copy link

@vercel vercel bot commented on aa778ca Mar 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.