Add TruncatedText component

This commit is contained in:
Alex Liebowitz 2016-08-04 04:08:12 -04:00
parent aa2f48f359
commit be31598ed9

View file

@ -11,6 +11,22 @@ var Icon = React.createClass({
} }
}); });
var TruncatedText = React.createClass({
propTypes: {
limit: React.PropTypes.string,
},
getDefaultProps: function() {
return {
limit: 250,
}
},
render: function() {
var text = this.props.children;
var limit = this.props.limit;
return <span>{text.slice(0, limit) + (text.length > limit ? ' ...' : '')}</span>;
}
});
var toolTipStyle = { var toolTipStyle = {
position: 'absolute', position: 'absolute',
zIndex: '1', zIndex: '1',