Skip to content

Commit b4b6927

Browse files
authored
Replace classnames with clsx (#599)
clsx is fully compatible with classnames API, is quickly gaining traction and is about 1/3rd smaller than classnames.
1 parent 781ef77 commit b4b6927

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

lib/Draggable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import * as React from 'react';
33
import PropTypes from 'prop-types';
44
import ReactDOM from 'react-dom';
5-
import classNames from 'classnames';
5+
import clsx from 'clsx';
66
import {createCSSTransform, createSVGTransform} from './utils/domFns';
77
import {canDragX, canDragY, createDraggableData, getBoundPosition} from './utils/positionFns';
88
import {dontSetMe} from './utils/shims';
@@ -375,7 +375,7 @@ class Draggable extends React.Component<DraggableProps, DraggableState> {
375375
}
376376

377377
// Mark with class while dragging
378-
const className = classNames((children.props.className || ''), defaultClassName, {
378+
const className = clsx((children.props.className || ''), defaultClassName, {
379379
[defaultClassNameDragging]: this.state.dragging,
380380
[defaultClassNameDragged]: this.state.dragged
381381
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"test"
9090
],
9191
"dependencies": {
92-
"classnames": "^2.2.5",
92+
"clsx": "^1.1.1",
9393
"prop-types": "^15.6.0"
9494
},
9595
"peerDependencies": {

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,11 +1860,6 @@ class-utils@^0.3.5:
18601860
isobject "^3.0.0"
18611861
static-extend "^0.1.1"
18621862

1863-
classnames@^2.2.5:
1864-
version "2.2.6"
1865-
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.6.tgz#43935bffdd291f326dad0a205309b38d00f650ce"
1866-
integrity sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q==
1867-
18681863
cliui@^5.0.0:
18691864
version "5.0.0"
18701865
resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5"
@@ -1892,6 +1887,11 @@ clone-deep@^4.0.1:
18921887
kind-of "^6.0.2"
18931888
shallow-clone "^3.0.0"
18941889

1890+
clsx@^1.1.1:
1891+
version "1.1.1"
1892+
resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.1.1.tgz#98b3134f9abbdf23b2663491ace13c5c03a73188"
1893+
integrity sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA==
1894+
18951895
collection-visit@^1.0.0:
18961896
version "1.0.0"
18971897
resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0"

0 commit comments

Comments
 (0)