Skip to content

Commit ab9d333

Browse files
authored
perf: uninstall classnames, install clsx (#663)
1 parent 2e160a2 commit ab9d333

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ coverage
2828
yarn.lock
2929
es
3030
package-lock.json
31+
pnpm-lock.yaml
3132
tmp/
3233
.history
3334
.storybook
@@ -41,4 +42,4 @@ tmp/
4142

4243
# dumi
4344
.dumi/tmp
44-
.dumi/tmp-production
45+
.dumi/tmp-production

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@
3838
},
3939
"dependencies": {
4040
"@rc-component/util": "^1.3.0",
41-
"classnames": "^2.2.5"
41+
"clsx": "^2.1.1"
4242
},
4343
"devDependencies": {
4444
"@rc-component/father-plugin": "^2.0.2",
4545
"@rc-component/np": "^1.0.4",
4646
"@testing-library/jest-dom": "^6.1.5",
4747
"@testing-library/react": "^16.2.0",
4848
"@types/jest": "^30.0.0",
49+
"@types/node": "^24.5.2",
4950
"@types/react": "^18.0.0",
5051
"@types/react-dom": "^18.0.0",
5152
"@umijs/fabric": "^4.0.1",

src/AjaxUploader.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint react/no-is-mounted:0,react/sort-comp:0,react/prop-types:0 */
2-
import clsx from 'classnames';
2+
import { clsx } from 'clsx';
33
import pickAttrs from '@rc-component/util/lib/pickAttrs';
44
import React, { Component } from 'react';
55
import attrAccept from './attr-accept';
@@ -329,11 +329,7 @@ class AjaxUploader extends Component<UploadProps> {
329329
hasControlInside,
330330
...otherProps
331331
} = this.props;
332-
const cls = clsx({
333-
[prefixCls]: true,
334-
[`${prefixCls}-disabled`]: disabled,
335-
[className]: className,
336-
});
332+
const cls = clsx(prefixCls, { [`${prefixCls}-disabled`]: disabled, [className]: className });
337333
// because input don't have directory/webkitdirectory type declaration
338334
const dirProps: any =
339335
directory || folder ? { directory: 'directory', webkitdirectory: 'webkitdirectory' } : {};

0 commit comments

Comments
 (0)