Skip to content

Commit

Permalink
Merge pull request #44 from gthomas-appfolio/updateFlag
Browse files Browse the repository at this point in the history
gt - Fix Flag component
  • Loading branch information
gthomas-appfolio authored Nov 8, 2016
2 parents deb28b6 + 9ef91a1 commit ccc6a1a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
30 changes: 26 additions & 4 deletions src/components/Flag.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
import React, { PropTypes } from 'react';
import { Tag } from 'reactstrap';

const Flag = (props) => <Tag {...props} />;
// TODO can remove this component once reactstrap moves Tag to Badge component.
const Flag = (props) => {
const {
className,
color,
pill,
tag: Component,
...attributes
} = props;

const propTypes = {
const classes = `${className} badge badge-${color} ${pill ? 'badge-pill' : false}`;

return (
<Component {...attributes} className={classes} />
);
};

Flag.propTypes = {
color: PropTypes.string,
pill: PropTypes.bool,
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
children: PropTypes.node,
className: PropTypes.string,
cssModule: PropTypes.object,
};

Flag.propTypes = propTypes;
Flag.defaultProps = {
color: 'default',
pill: false,
tag: 'span'
};

export default Flag;
2 changes: 0 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import {
TabContent,
TabPane,
Table,
Tag,
TetherContent,
Tooltip
} from 'reactstrap';
Expand Down Expand Up @@ -144,7 +143,6 @@ export {
TabContent,
TabPane,
Table,
Tag,
TetherContent,
Tooltip,

Expand Down

0 comments on commit ccc6a1a

Please sign in to comment.