Skip to content

Commit 56f19ea

Browse files
committed
perf: uninstall classnames, install clsx
1 parent 3a70945 commit 56f19ea

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ es
2626
coverage
2727
yarn.lock
2828
package-lock.json
29+
pnpm-lock.yaml
2930
.doc/
3031
dist
3132
.doc
@@ -34,4 +35,4 @@ dist
3435
.dumi/tmp-test
3536
.dumi/tmp-production
3637

37-
bun.lockb
38+
bun.lockb

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@
4141
},
4242
"dependencies": {
4343
"@rc-component/util": "^1.3.0",
44-
"classnames": "^2.2.5"
44+
"clsx": "^2.1.1"
4545
},
4646
"devDependencies": {
4747
"@rc-component/father-plugin": "^2.1.3",
4848
"@rc-component/np": "^1.0.0",
4949
"@rc-component/tooltip": "^1.2.1",
50-
"@types/classnames": "^2.2.9",
5150
"@types/jest": "^29.5.1",
51+
"@types/node": "^24.5.2",
5252
"@types/react": "^17.0.15",
5353
"@types/react-dom": "^17.0.9",
5454
"@umijs/fabric": "^3.0.0",

src/Rate.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import useControlledState from '@rc-component/util/lib/hooks/useControlledState';
22
import KeyCode from '@rc-component/util/lib/KeyCode';
33
import pickAttrs from '@rc-component/util/lib/pickAttrs';
4-
import classNames from 'classnames';
4+
import { clsx } from 'clsx';
55
import React from 'react';
66
import type { StarProps } from './Star';
77
import Star from './Star';
@@ -221,7 +221,7 @@ function Rate(props: RateProps, ref: React.Ref<RateRef>) {
221221
/>
222222
));
223223

224-
const classString = classNames(prefixCls, className, {
224+
const classString = clsx(prefixCls, className, {
225225
[`${prefixCls}-disabled`]: disabled,
226226
[`${prefixCls}-rtl`]: direction === 'rtl',
227227
});

src/Star.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import KeyCode from '@rc-component/util/lib/KeyCode';
3-
import classNames from 'classnames';
3+
import { clsx } from 'clsx';
44

55
export interface StarProps {
66
value?: number;
@@ -76,8 +76,9 @@ function Star(props: StarProps, ref: React.Ref<HTMLLIElement>) {
7676

7777
// >>>>> Node
7878
const characterNode = typeof character === 'function' ? character(props) : character;
79+
7980
let start: React.ReactNode = (
80-
<li className={classNames(Array.from(classNameList))} ref={ref}>
81+
<li className={clsx(Array.from(classNameList))} ref={ref}>
8182
<div
8283
onClick={disabled ? null : onInternalClick}
8384
onKeyDown={disabled ? null : onInternalKeyDown}

0 commit comments

Comments
 (0)