Skip to content

Commit

Permalink
refactor: remove object-assign, user spread operator.
Browse files Browse the repository at this point in the history
  • Loading branch information
Artemis330 committed Apr 21, 2017
1 parent 5a9a741 commit 404fef8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rc-slider",
"version": "7.0.1",
"version": "7.0.2",
"description": "Slider UI component for React",
"keywords": [
"react",
Expand Down Expand Up @@ -68,7 +68,6 @@
"dependencies": {
"babel-runtime": "6.x",
"classnames": "^2.2.5",
"object-assign": "^4.1.1",
"prop-types": "^15.5.4",
"rc-tooltip": "^3.4.2",
"rc-util": "^4.0.0",
Expand Down
8 changes: 6 additions & 2 deletions src/Handle.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import React from 'react';
import PropTypes from 'prop-types';
import assign from 'object-assign';

export default class Handle extends React.Component {
render() {
const {
className, vertical, offset, handleStyle, ...restProps,
} = this.props;
const style = vertical ? { bottom: `${offset}%` } : { left: `${offset}%` };
return <div {...restProps} className={className} style={assign({}, style, handleStyle)} />;

const elStyle = {
...style,
...handleStyle,
};
return <div {...restProps} className={className} style={elStyle} />;
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/common/Track.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import assign from 'object-assign';

const Track = ({
className, included, vertical, offset, length, minimumTrackStyle,
Expand All @@ -14,8 +13,11 @@ const Track = ({
style.left = `${offset}%`;
style.width = `${length}%`;
}

return <div className={className} style={assign({}, style, minimumTrackStyle)} />;
const elStyle = {
...style,
...minimumTrackStyle,
};
return <div className={className} style={elStyle} />;
};

export default Track;

0 comments on commit 404fef8

Please sign in to comment.