Skip to content

Commit

Permalink
Add className prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Minh Tran committed Jun 24, 2016
1 parent d920d37 commit b082834
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Example [here](http://codepen.io/vn38minhtran/pen/QjaZrm)
| autoIncrement | bool | false | if `true` percent will auto increment `Math.random() + 1 - Math.random()`% in `intervalTime` ms. |
| intervalTime | number | 200 | Interval time for auto increment. |
| spinner | oneOf([false, 'left', 'right']) | left | Spinner position. Pass `false` to hide spinner icon. |
| className | string | | Custom class |

## Example

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-progress-bar-plus",
"version": "1.1.0",
"version": "1.2.0",
"description": "Progress bar component for ReactJS.",
"main": ["dist/progress-bar.css", "dist/react-progress-bar-plus.js"],
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion dist/react-progress-bar-plus.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/app/components/pages/Home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PageHome extends React.Component {
return (
<Document title="Home | React progress bar plus" className="page-home">
<div>
<ProgressBar percent={this.state.percent}/>
<ProgressBar className="custom-class" percent={this.state.percent}/>
<div className="text-center">
<div className="btn-group">
<button className="btn btn-default" onClick={this.setPercent(0)}>
Expand Down
4 changes: 3 additions & 1 deletion lib/ProgressBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ var ProgressBar = (function (_React$Component) {
var _props = this.props;
var onTop = _props.onTop;
var spinner = _props.spinner;
var className = _props.className;
var percent = this.state.percent;

var className = (0, _classnames3['default'])('react-progress-bar', {
className = (0, _classnames3['default'])('react-progress-bar', className, {
'react-progress-bar-on-top': onTop,
'react-progress-bar-hide': percent < 0 || percent >= 100
});
Expand All @@ -122,6 +123,7 @@ var ProgressBar = (function (_React$Component) {
}], [{
key: 'propTypes',
value: {
className: _react2['default'].PropTypes.string,
percent: _react2['default'].PropTypes.number.isRequired,
onTop: _react2['default'].PropTypes.bool,
autoIncrement: _react2['default'].PropTypes.bool,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-progress-bar-plus",
"version": "1.1.0",
"version": "1.2.0",
"description": "Progress bar component for ReactJS.",
"main": "lib/index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/ProgressBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ class ProgressBar extends React.Component {
};

render() {
let {onTop, spinner} = this.props;
let {onTop, spinner, className} = this.props;
let {percent} = this.state;
let className = classnames('react-progress-bar', this.props.className, {
className = classnames('react-progress-bar', className, {
'react-progress-bar-on-top': onTop,
'react-progress-bar-hide': percent < 0 || percent >= 100
});
Expand Down

0 comments on commit b082834

Please sign in to comment.