From d68c6956a63673b2599817eef646e64b2f505942 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Sun, 28 Sep 2025 02:32:21 +0800 Subject: [PATCH] perf: uninstall classnames, install clsx --- package.json | 3 +-- src/DrawerPanel.tsx | 4 ++-- src/DrawerPopup.tsx | 38 +++++++++++--------------------------- src/hooks/useDrag.ts | 4 ++-- 4 files changed, 16 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index 8af86736..192ec688 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "@rc-component/motion": "^1.1.4", "@rc-component/portal": "^2.0.0", "@rc-component/util": "^1.2.1", - "classnames": "^2.2.6" + "clsx": "^2.1.1" }, "devDependencies": { "@ant-design/icons": "^5.3.0", @@ -54,7 +54,6 @@ "@rc-component/np": "^1.0.0", "@testing-library/jest-dom": "^6.2.0", "@testing-library/react": "^16.3.0", - "@types/classnames": "^2.2.9", "@types/jest": "^29.5.11", "@types/node": "^24.3.0", "@types/raf": "^3.4.0", diff --git a/src/DrawerPanel.tsx b/src/DrawerPanel.tsx index a8e08374..29c05216 100644 --- a/src/DrawerPanel.tsx +++ b/src/DrawerPanel.tsx @@ -1,4 +1,4 @@ -import classNames from 'classnames'; +import { clsx } from 'clsx'; import * as React from 'react'; import { RefContext } from './context'; import pickAttrs from '@rc-component/util/lib/pickAttrs'; @@ -43,7 +43,7 @@ const DrawerPanel: React.FC> = props => { return (
(
@@ -372,11 +368,8 @@ const DrawerPopup: React.ForwardRefRenderFunction< id={id} containerRef={motionRef} prefixCls={prefixCls} - className={classNames(className, drawerClassNames?.section)} - style={{ - ...style, - ...styles?.section, - }} + className={clsx(className, drawerClassNames?.section)} + style={{ ...style, ...styles?.section }} {...pickAttrs(props, { aria: true })} {...eventHandlers} > @@ -386,17 +379,13 @@ const DrawerPopup: React.ForwardRefRenderFunction< return (
{isResizable &&
} @@ -419,15 +408,10 @@ const DrawerPopup: React.ForwardRefRenderFunction< return (