Skip to content

Commit

Permalink
pass all other props to top element
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieudutour committed Oct 6, 2015
1 parent 6d2258d commit ad87145
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var App = React.createClass({

### Props

All props are optional.
All props are optional. All props other than that will be passed to the top element.

##### classNamespace

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"react-progress-button.js",
"react-progress-button.css"
],
"version": "1.1.0",
"version": "2.0.0",
"homepage": "https://github.com/mathieudutour/react-progress-button",
"description": "Simple react.js component for a inline progress indicator",
"keywords": [
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-button",
"version": "1.1.0",
"version": "2.0.0",
"description": "Simple react.js component for a inline progress indicator",
"main": "react-progress-button.js",
"dependencies": {
Expand Down
24 changes: 16 additions & 8 deletions react-progress-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
}
})(this, function (React) {
"use strict";
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

var ProgressButton = React.createClass({displayName: "ProgressButton",
propTypes: {
Expand Down Expand Up @@ -42,22 +43,29 @@
},

render: function() {
var className = this.props.className;
var classNamespace = this.props.classNamespace;
var children = this.props.children;
var type = this.props.type;
var form = this.props.form;

var containerProps = _objectWithoutProperties(this.props, ["classNamespace", "children", "type", "form", "durationError", "durationSuccess", "onClick", "onError", "state", "shouldAllowClickOnLoading"]);
containerProps.className = classNamespace + "container " + this.state.currentState + ' ' + className;
containerProps.onClick = this.handleClick;
return (
React.createElement("div", {className: this.props.classNamespace + "container " + this.state.currentState,
onClick: this.handleClick},
React.createElement("button", {type: this.props.type, form: this.props.form,
className: this.props.classNamespace + "button"},
React.createElement("span", null, this.props.children),
React.createElement("svg", {className: this.props.classNamespace + "progress-circle",
React.createElement("div", containerProps,
React.createElement("button", {type: type, form: form, className: classNamespace + "button"},
React.createElement("span", null, children),
React.createElement("svg", {className: classNamespace + "progress-circle",
viewBox: "0 0 41 41"},
React.createElement("path", {d: "M38,20.5 C38,30.1685093 30.1685093,38 20.5,38"})
),
React.createElement("svg", {className: this.props.classNamespace + "checkmark",
React.createElement("svg", {className: classNamespace + "checkmark",
viewBox: "0 0 70 70"},
React.createElement("path", {d: "m31.5,46.5l15.3,-23.2"}),
React.createElement("path", {d: "m31.5,46.5l-8.5,-7.1"})
),
React.createElement("svg", {className: this.props.classNamespace + "cross",
React.createElement("svg", {className: classNamespace + "cross",
viewBox: "0 0 70 70"},
React.createElement("path", {d: "m35,35l-9.3,-9.3"}),
React.createElement("path", {d: "m35,35l9.3,9.3"}),
Expand Down

0 comments on commit ad87145

Please sign in to comment.