Simplify content wrapping logic in Link

This commit is contained in:
Alex Liebowitz 2017-01-23 19:22:25 -05:00
parent b2fd38a1c8
commit ef393ca360

View file

@ -36,19 +36,19 @@ export let Link = React.createClass({
if (this.props.children) { // Custom content
content = this.props.children;
} else {
content = [
'icon' in this.props ? <Icon icon={this.props.icon} fixed={true} /> : null,
<span className="link-label">{this.props.label}</span>,
'badge' in this.props ? <span className="badge">{this.props.badge}</span> : null,
];
content = (
<span {... 'button' in this.props ? {className: 'button__content'} : {}}>
{'icon' in this.props ? <Icon icon={this.props.icon} fixed={true} /> : null}
{<span className="link-label">{this.props.label}</span>}
{'badge' in this.props ? <span className="badge">{this.props.badge}</span> : null}
</span>
);
}
return (
<a className={className} href={this.props.href || 'javascript:;'} title={this.props.title}
onClick={this.handleClick} {... 'style' in this.props ? {style: this.props.style} : {}}>
{'button' in this.props
? <span className="button__content">{content}</span>
: content}
{content}
</a>
);
}