split out tool tip to separate component

This commit is contained in:
Jeremy Kauffman 2016-08-07 16:36:57 -04:00 committed by Alex Liebowitz
parent 45f14598b9
commit 98ebf02ca6
2 changed files with 26 additions and 2 deletions

View file

@ -1,8 +1,30 @@
var Link = React.createClass({
handleClick: function() {
if (this.props.onClick) {
this.props.onClick();
}
},
render: function() {
var href = this.props.href ? this.props.href : 'javascript:;',
icon = this.props.icon ? <Icon icon={this.props.icon} /> : '',
className = (this.props.button ? 'button-block button-' + this.props.button : 'button-text') +
(this.props.hidden ? ' hidden' : '') + (this.props.disabled ? ' disabled' : '') + ' ' + this.props.className;
return (
<a className={className} href={href} style={this.props.style ? this.props.style : {}}
title={this.props.title} onClick={this.handleClick}>
{this.props.icon ? icon : '' }
{this.props.label}
</a>
);
}
});
var linkContainerStyle = { var linkContainerStyle = {
position: 'relative', position: 'relative',
}; };
var Link = React.createClass({ var ToolTipLink = React.createClass({
getInitialState: function() { getInitialState: function() {
return { return {
showTooltip: false, showTooltip: false,
@ -47,6 +69,7 @@ var Link = React.createClass({
} }
}); });
var ReturnLink = React.createClass({ var ReturnLink = React.createClass({
render: function() { render: function() {
return <div style={ { padding: '24px 0' } }><Link return <div style={ { padding: '24px 0' } }><Link

View file

@ -224,7 +224,8 @@ var FeaturedContent = React.createClass({
<h3>Featured Content</h3> <h3>Featured Content</h3>
</div> </div>
<div className="span6"> <div className="span6">
<h3>Community Content <Link style={featuredContentLegendStyle} label="What's this?" tooltip='Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names "one," "two," "three" and "four" to put your content here!' /></h3> <h3>Community Content <ToolTipLink style={featuredContentLegendStyle} label="What's this?"
tooltip='Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names "one," "two," "three" and "four" to put your content here!' /></h3>
</div> </div>
</div> </div>