react-ajaxing
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -10,17 +10,31 @@ // Generated by CoffeeScript 1.9.3 | ||
displayName: "ajaxing", | ||
getDefaultProps: function() {}, | ||
getDefaultProps: function() { | ||
return { | ||
size: '20' | ||
}; | ||
}, | ||
render: function() { | ||
var classes; | ||
classes = 'ajax-double-bounce'; | ||
var classes, style; | ||
classes = 'react-ajaxing'; | ||
if (this.props.className) { | ||
classes = classes + " " + this.props.className; | ||
} | ||
if (this.props.size) { | ||
style = { | ||
width: this.props.size + "px", | ||
height: this.props.size + "px" | ||
}; | ||
} | ||
if (this.props.loading) { | ||
return React.createElement("div", React.__spread({}, this.props, { | ||
"className": classes | ||
"className": classes, | ||
"style": style | ||
}), React.createElement("div", { | ||
"className": "ajax-double-bounce", | ||
"style": style | ||
}, React.createElement("div", { | ||
"className": "ajax-double-bounce1" | ||
}), React.createElement("div", { | ||
"className": "ajax-double-bounce2" | ||
})); | ||
}))); | ||
} else { | ||
@@ -27,0 +41,0 @@ return this.props.children; |
{ | ||
"name": "react-ajaxing", | ||
"description": "tell the component ajax is sending", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"author": "Bingo Yang <blackbing@gmail.com>", | ||
@@ -6,0 +6,0 @@ "browserify": { |
# react-ajaxing | ||
tell the component ajax is sending | ||
[![react-ajaxing](http://i.imgur.com/A3PPhCY.gif)](http://i.imgur.com/A3PPhCY.gif) | ||
# Usage | ||
```jsx | ||
var Spinner = require('react-ajaxing'); | ||
//... | ||
login: function(){ | ||
this.setState({ | ||
loading: true | ||
}); | ||
this.setTimeout( ()=>{ | ||
this.setState({ | ||
loading: false | ||
}); | ||
}, 1500); | ||
}, | ||
render: function(){ | ||
return ( | ||
<button type ="submit" onClick={@login}> | ||
<Spinner loading={@state.loading} size={20}><span>Login</span></Spinner> | ||
</button> | ||
) | ||
} | ||
``` | ||
# Options | ||
### size(number): spinner size(px) | ||
default: 20 | ||
### loading(boolean): indicate it is loading status or not | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5735
77
40