Newer
Older
import PropTypes from 'prop-types';
import React from 'react';
import { Glyphicon, Label } from 'react-bootstrap';
/** React component which renders a tag label */
const { tag, showDeleteButton } = this.props;
<div style={{ display: 'inline-block', marginRight: 4 }}>
<p>
<Label
style={{
backgroundColor: tag.color,
}}
>
<Glyphicon glyph="tag" />
{tag.name.toUpperCase()}
</Label>
</p>
backgroundColor: '#777',
borderTopRightRadius: 5,
borderBottomRightRadius: 5,
display: 'inline-block',
marginBottom: 2,
paddingLeft: 0,
paddingRight: 1,
}}
>
<Glyphicon
glyph="remove"
bsSize="xsmall"
style={{
backgroundColor: '#777',
color: 'white',
verticalAlign: 'bottom',
}}
onClick={() => this.props.onDeleteTagClicked(tag)}
/>
</Label>
/* Callback function used to remove a tag from the selection. Used in EVENT context only */
onDeleteTagClicked: PropTypes.func,
/* Whether the delete button is displayed or not */
showDeleteButton: PropTypes.bool,
/* the tag to render */
tag: PropTypes.object.isRequired,
};
TagLabel.defaultProps = {