Forked from tugberkugurlu/LoadingIndicator.js
Last active
September 11, 2016 21:41
-
-
Save luisrudge/c37bb07781123a9da1199debb16a90f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { PropTypes } from 'react'; | |
import LoadingIndicator from 'components/LoadingIndicator'; | |
export const Test = () => ( | |
<LoadingIndicator isLoading> | |
{() => ( | |
<div> | |
This is only evaluated when isLoading===false | |
</div> | |
)} | |
</LoadingIndicator> | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'loaders.css/loaders.css'; | |
import './index.scss'; | |
import React, { PropTypes } from 'react'; | |
const LoadingIndicator = React.createClass({ | |
propTypes: { | |
children: PropTypes.func.isRequired, | |
isLoading: PropTypes.bool.isRequired | |
}, | |
render: function() { | |
if(this.props.isLoading) { | |
return <div className="loading-indicator-holder"> | |
<div className="loader-inner square-spin inner"><div></div></div> | |
</div>; | |
} | |
return <div>{this.props.children()}</div>; | |
} | |
}); | |
export default LoadingIndicator; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment