diff --git a/README.md b/README.md index 7b49b6f..464fd36 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,12 @@ ##### Loading Text +##### CSS Class + + +##### Font Awesome Icon + + ### Development Install `http-server` from npm, run it and go to http://127.0.0.1:8080/ diff --git a/index.js b/index.js index f1e122e..54b5d76 100644 --- a/index.js +++ b/index.js @@ -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) ); } diff --git a/package.json b/package.json index 8a86676..06d1c4f 100644 --- a/package.json +++ b/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": {