Skip to content

Commit

Permalink
fix: typo (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangkairan authored Jun 28, 2024
1 parent 569e893 commit bb2133b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/DraggablePanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import useControlledState from 'use-merge-value';
import { DivProps } from '@/types';

import { useStyles } from './style';
import { revesePlacement } from './utils';
import { reversePlacement } from './utils';

const DEFAULT_HEIGHT = 180;
const DEFAULT_WIDTH = 280;
Expand Down Expand Up @@ -56,6 +56,8 @@ export interface DraggablePanelProps extends DivProps {
* @description The style of the panel handler
* @type CSSProperties
*/
handlerStyle?: CSSProperties;
/** @deprecated please use `handlerStyle` instead */
hanlderStyle?: CSSProperties;
headerHeight?: number;
maxHeight?: number;
Expand Down Expand Up @@ -139,6 +141,7 @@ const DraggablePanel = memo<DraggablePanelProps>(
showHandlerWhenUnexpand,
destroyOnClose,
hanlderStyle,
handlerStyle,
classNames = {},
dir,
}) => {
Expand Down Expand Up @@ -181,7 +184,8 @@ const DraggablePanel = memo<DraggablePanelProps>(
if (!canResizing) return {};

return {
[revesePlacement(internalPlacement)]: styles[`${revesePlacement(internalPlacement)}Handle`],
[reversePlacement(internalPlacement)]:
styles[`${reversePlacement(internalPlacement)}Handle`],
};
}, [canResizing, internalPlacement]);

Expand All @@ -194,7 +198,7 @@ const DraggablePanel = memo<DraggablePanelProps>(
top: false,
topLeft: false,
topRight: false,
[revesePlacement(internalPlacement)]: true,
[reversePlacement(internalPlacement)]: true,
...(resize as Enable),
};

Expand Down Expand Up @@ -259,7 +263,7 @@ const DraggablePanel = memo<DraggablePanelProps>(
onClick={() => {
setIsExpand(!isExpand);
}}
style={hanlderStyle}
style={handlerStyle || hanlderStyle}
>
<div
className={styles.handlerIcon}
Expand Down
2 changes: 1 addition & 1 deletion src/DraggablePanel/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { placementType } from './index';

export const revesePlacement = (placement: placementType) => {
export const reversePlacement = (placement: placementType) => {
switch (placement) {
case 'bottom': {
return 'top';
Expand Down

0 comments on commit bb2133b

Please sign in to comment.