Skip to content

Instantly share code, notes, and snippets.

@msociety
Last active January 27, 2017 17:27
Show Gist options
  • Save msociety/bd13eae2b096c9954b944b897826f570 to your computer and use it in GitHub Desktop.
Save msociety/bd13eae2b096c9954b944b897826f570 to your computer and use it in GitHub Desktop.
React Component "IconStack" using Font Awesome
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