-
Notifications
You must be signed in to change notification settings - Fork 9
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 #44 from gthomas-appfolio/updateFlag
gt - Fix Flag component
- Loading branch information
Showing
2 changed files
with
26 additions
and
6 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
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; |
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