Skip to content

Commit 28f97f5

Browse files
committed
perf: uninstall classnames, install clsx
1 parent 114f973 commit 28f97f5

File tree

5 files changed

+17
-20
lines changed

5 files changed

+17
-20
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ es
2929
coverage/
3030
yarn.lock
3131
package-lock.json
32+
pnpm-lock.yaml
3233
.storybook
3334
.doc
3435

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,17 @@
3939
"coverage": "father test --coverage",
4040
"now-build": "npm run docs:build"
4141
},
42-
"peerDependencies": {
43-
"react": ">=16.9.0",
44-
"react-dom": ">=16.9.0"
45-
},
4642
"dependencies": {
4743
"@rc-component/util": "^1.2.1",
48-
"classnames": "^2.2.6"
44+
"clsx": "^2.1.1"
4945
},
5046
"devDependencies": {
5147
"@rc-component/father-plugin": "^2.0.4",
5248
"@rc-component/np": "^1.0.4",
5349
"@testing-library/react": "^13.0.0",
54-
"@types/classnames": "^2.2.9",
5550
"@types/jest": "^29.4.0",
5651
"@types/keyv": "3.1.4",
52+
"@types/node": "^24.5.2",
5753
"@types/react": "^18.0.9",
5854
"@types/react-dom": "^18.0.3",
5955
"@umijs/fabric": "^3.0.0",
@@ -69,5 +65,9 @@
6965
"react": "^18.0.0",
7066
"react-dom": "^18.0.0",
7167
"typescript": "^5.0.0"
68+
},
69+
"peerDependencies": {
70+
"react": ">=16.9.0",
71+
"react-dom": ">=16.9.0"
7272
}
7373
}

src/Circle/PtgCircle.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import * as React from 'react';
22
import type { ProgressProps } from '..';
33
import type { StrokeColorObject } from '../interface';
4-
import classNames from 'classnames';
4+
import { clsx } from 'clsx';
55

66
interface BlockProps {
77
bg: string;
8-
children?: React.ReactNode;
98
}
109

11-
const Block: React.FC<BlockProps> = ({ bg, children }) => (
10+
const Block: React.FC<React.PropsWithChildren<BlockProps>> = ({ bg, children }) => (
1211
<div style={{ width: '100%', height: '100%', background: bg }}>{children}</div>
1312
);
1413

@@ -59,7 +58,7 @@ const PtgCircle = React.forwardRef<SVGCircleElement, ColorGradientProps>((props,
5958

6059
const circleNode = (
6160
<circle
62-
className={classNames(`${prefixCls}-circle-path`, className)}
61+
className={clsx(`${prefixCls}-circle-path`, className)}
6362
r={radius}
6463
cx={halfSize}
6564
cy={halfSize}

src/Circle/index.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import cls from 'classnames';
2+
import { clsx } from 'clsx';
33
import { defaultProps, useTransitionDuration } from '../common';
44
import type { ProgressProps } from '../interface';
55
import useId from '@rc-component/util/lib/hooks/useId';
@@ -151,7 +151,7 @@ const Circle: React.FC<ProgressProps> = (props) => {
151151
return (
152152
<circle
153153
key={index}
154-
className={cls(`${prefixCls}-circle-path`, classNames.track)}
154+
className={clsx(`${prefixCls}-circle-path`, classNames.track)}
155155
r={radius}
156156
cx={halfSize}
157157
cy={halfSize}
@@ -169,7 +169,7 @@ const Circle: React.FC<ProgressProps> = (props) => {
169169

170170
return (
171171
<svg
172-
className={cls(`${prefixCls}-circle`, classNames.root, className)}
172+
className={clsx(`${prefixCls}-circle`, classNames.root, className)}
173173
viewBox={`0 0 ${VIEW_BOX_SIZE} ${VIEW_BOX_SIZE}`}
174174
style={{
175175
...styles.root,
@@ -181,17 +181,14 @@ const Circle: React.FC<ProgressProps> = (props) => {
181181
>
182182
{!stepCount && (
183183
<circle
184-
className={cls(`${prefixCls}-circle-rail`, classNames.rail)}
184+
className={clsx(`${prefixCls}-circle-rail`, classNames.rail)}
185185
r={radius}
186186
cx={halfSize}
187187
cy={halfSize}
188188
stroke={railColor}
189189
strokeLinecap={mergedStrokeLinecap}
190190
strokeWidth={railWidth || strokeWidth}
191-
style={{
192-
...circleStyle,
193-
...styles.rail,
194-
}}
191+
style={{ ...circleStyle, ...styles.rail }}
195192
/>
196193
)}
197194
{stepCount ? getStepStokeList() : getStokeList()}

src/Line.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import classNames from 'classnames';
2+
import { clsx } from 'clsx';
33
import { useTransitionDuration, defaultProps } from './common';
44
import type { ProgressProps } from './interface';
55
import getIndeterminateLine from './utils/getIndeterminateLine';
@@ -50,7 +50,7 @@ const Line: React.FC<ProgressProps> = (props) => {
5050

5151
return (
5252
<svg
53-
className={classNames(`${prefixCls}-line`, className)}
53+
className={clsx(`${prefixCls}-line`, className)}
5454
viewBox={viewBoxString}
5555
preserveAspectRatio="none"
5656
style={style}

0 commit comments

Comments
 (0)