Last active
January 27, 2017 17:27
-
-
Save msociety/bd13eae2b096c9954b944b897826f570 to your computer and use it in GitHub Desktop.
React Component "IconStack" using Font Awesome
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, { PropTypes } from 'react'; | |
/* |Prop |Type |Default |Description | | |
* |-----------|--------|-----------|--------------------------------------------| | |
* |[children] |`node` |`undefined`|Required: Child elements | | |
* |[size] |`string`|`undefined`|Increase size: 'lg', '2x', '3x', '4x', '5x' | | |
* |[className]|`string`|`undefined`|Set a CSS class for extra styles | */ | |
const IconStack = ({ | |
className, | |
size, | |
children, | |
...props | |
}) => { | |
const classNames = ` | |
fa-stack | |
${size ? `fa-${size}` : ''} | |
${className ? className : ''} | |
`; | |
return ( | |
<span {...props} className={classNames}> | |
{children} | |
</span> | |
); | |
}; | |
IconStack.propTypes = { | |
className: PropTypes.string, | |
size: PropTypes.oneOf(['lg', '2x', '3x', '4x', '5x']), | |
children: PropTypes.node.isRequired | |
}; | |
export default IconStack; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment