Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao committed Aug 11, 2024
1 parent 7ea512a commit aa0ba99
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export const Dialog: React.FC<DialogProps> = (props) => {
>
{showOverlay ? (
<animated.div style={maskSpring}>
<Overlay onOverlayClick={onOverlayClickHandle} disableBodyScroll={false} />
<Overlay visible={visible} onClick={onOverlayClickHandle} />
</animated.div>
) : null}
<div className="wrap" style={wrapStyle}>
Expand Down
18 changes: 4 additions & 14 deletions src/drawer/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,8 @@ enum PopupSourceEnum {
}

const Drawer: React.FC<TdDrawerProps> = (props) => {
const {
items,
visible,
showOverlay,
zIndex,
closeOnOverlayClick,
destroyOnClose,
placement,
onClose,
onItemClick,
onOverlayClick,
} = props;
const { items, visible, showOverlay, zIndex, closeOnOverlayClick, placement, onClose, onItemClick, onOverlayClick } =
props;

const { classPrefix } = useConfig();
const name = `${classPrefix}-drawer`;
Expand All @@ -34,7 +24,7 @@ const Drawer: React.FC<TdDrawerProps> = (props) => {

const [show, setShow] = useState(visible);

const handleOverlayClick = (e: React.MouseEvent<HTMLDivElement>) => {
const handleOverlayClick = (e) => {
const context = { e };
onOverlayClick?.(context);
if (closeOnOverlayClick) {
Expand All @@ -57,9 +47,9 @@ const Drawer: React.FC<TdDrawerProps> = (props) => {
<Popup
visible={show}
placement={placement}
overlayProps={{ onOverlayClick: handleOverlayClick, destroyOnClose }}
showOverlay={showOverlay}
zIndex={zIndex}
onVisibleChange={handleOverlayClick}
>
<div className={`${name}__sidebar`}>
{items?.map((item, index) => {
Expand Down
11 changes: 1 addition & 10 deletions src/popup/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import classnames from 'classnames';
import { useSpring, animated } from 'react-spring';
import Overlay from '../overlay';
import useDefault from '../_util/useDefault';
import { PropagationEvent } from '../_util/withStopPropagation';
import withNativeProps, { NativeProps } from '../_util/withNativeProps';
import { TdPopupProps } from './type';
import useConfig from '../_util/useConfig';
Expand Down Expand Up @@ -79,15 +78,7 @@ const Popup: FC<PopupProps> = (props) => {
return withNativeProps(
props,
<div className={`${name}`} style={rootStyles}>
{showOverlay && (
<Overlay
visible={show}
onOverlayClick={handleOverlayClick}
disableBodyScroll={false}
stopPropagation={[PropagationEvent.CLICK, PropagationEvent.SCROLL]}
{...overlayProps}
/>
)}
{showOverlay && <Overlay visible={show} onClick={handleOverlayClick} {...overlayProps} />}
<animated.div className={classnames([`${name}--content`, `${name}--content-${placement}`])} style={contentStyle}>
{active && children}
</animated.div>
Expand Down

0 comments on commit aa0ba99

Please sign in to comment.