-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from monkvision/feature-loader
Add a beautiful Loader component
- Loading branch information
Showing
9 changed files
with
207 additions
and
20 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import PropTypes from 'prop-types'; | ||
|
||
export function progress(props, propName, componentName) { | ||
const value = props[propName]; | ||
|
||
const notANumber = typeof value !== 'number'; | ||
const notInTheRange = !notANumber && (value < 0 || value > 99); | ||
|
||
if (notANumber || notInTheRange) { | ||
return new Error( | ||
` | ||
Invalid prop \`${propName}\` supplied to\`${componentName}\`. | ||
It must be a number between 0 and 99 included. | ||
`, | ||
); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
export const nodeEnv = PropTypes.oneOf(['development', 'test', 'production']); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Logo from 'Components/Logo'; | ||
|
||
/** | ||
* Display a loader built with the Monk Logo | ||
* @param isLoading | ||
* @param logoProps {object} passed through <Logo /> | ||
* @returns {JSX.Element} | ||
* @constructor | ||
*/ | ||
function Loader({ isLoading, ...logoProps }) { | ||
return <Logo animated={isLoading} {...logoProps} />; | ||
} | ||
|
||
Loader.propTypes = { | ||
isLoading: PropTypes.bool, | ||
}; | ||
|
||
Loader.defaultProps = { | ||
isLoading: false, | ||
}; | ||
|
||
export default Loader; |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { default as Logo } from './Logo'; | ||
export { default as Loader } from './Loader'; | ||
export { default as NodeEnv } from './NodeEnv'; |
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