Created
November 1, 2018 10:32
-
-
Save smddzcy/e05860c47178044f4ca973f343bee8a6 to your computer and use it in GitHub Desktop.
A basic loading indicator
This file contains 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 from 'react'; | |
import PropTypes from 'prop-types'; | |
function Loading({ size, fullScreen, isGold }) { | |
const style = { | |
borderWidth: `${size / 10}px`, | |
width: `${size}px`, | |
height: `${size}px`, | |
}; | |
if (fullScreen) { | |
return ( | |
<div className="center-absolute"> | |
<div className="loader" style={style} /> | |
</div> | |
); | |
} | |
return <div className="loader" style={style} />; | |
} | |
Loading.propTypes = { | |
size: PropTypes.number, | |
fullScreen: PropTypes.bool, | |
isGold: PropTypes.bool, | |
}; | |
Loading.defaultProps = { | |
size: 50, | |
fullScreen: false, | |
}; | |
export default Loading; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Required CSS: