Skip to content

Commit

Permalink
Merge pull request #5 from ekonstantinidis/icon-class
Browse files Browse the repository at this point in the history
Allow className & font awesome icons
  • Loading branch information
ekonstantinidis committed May 7, 2015
2 parents ec27f09 + 9784cfe commit 7a4e569
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -50,6 +50,12 @@
##### Loading Text
<Loading shouldShow={this.state.loading} text='Checking your details...' />

##### CSS Class
<Loading shouldShow={this.state.loading} className='loading-wrapper' />

##### Font Awesome Icon
<Loading shouldShow={this.state.loading} faIcon='fa fa-refresh fa-spin' />


### Development
Install `http-server` from npm, run it and go to http://127.0.0.1:8080/
Expand Down
11 changes: 9 additions & 2 deletions index.js
Expand Up @@ -7,14 +7,21 @@ module.exports = React.createClass({
displayName: 'Reloading',

render: function () {
var text = this.props.text ? this.props.text : 'Loading...';
var classname = this.props.className ? this.props.className : '';
var content = this.props.text ? this.props.text : 'Loading';

if (this.props.faIcon) {
content = React.createElement("i", {className: this.props.faIcon}, '');
}

if (!this.props.shouldShow) {
loadingStyle.display = 'none';
} else {
loadingStyle.display = 'block';
}

return (
React.createElement("div", {style: loadingStyle}, text)
React.createElement("div", {className: classname, style: loadingStyle}, content)
);

}
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "reloading",
"version": "0.0.3",
"version": "0.0.4",
"description": "A Loading component for ReactJS.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 7a4e569

Please sign in to comment.