Skip to content

Instantly share code, notes, and snippets.

@mnicole
Last active August 3, 2017 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnicole/c04c106a3fb49d542bb366601828611d to your computer and use it in GitHub Desktop.
Save mnicole/c04c106a3fb49d542bb366601828611d to your computer and use it in GitHub Desktop.
Badge Component
import React, { PropTypes } from ‘react’;
const Badge = ({ text, context, className, style, ...otherProps }) => {
const classes = `${context} ${className}`;
return (
<span className={ classes } style={ style } { ...otherProps }>{ text }</span>
);
};
Badge.defaultProps = {
text: ‘’,
context: ‘default’,
className: ‘’,
style: {}
};
Badge.propTypes = {
text: PropTypes.string,
context: PropTypes.string,
className: PropTypes.string,
style: PropTypes.object
};
export default Badge;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment