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 if (this.props.children) { // Custom content
content = this.props.children; content = this.props.children;
} else { } else {
content = [ content = (
'icon' in this.props ? <Icon icon={this.props.icon} fixed={true} /> : null, <span {... 'button' in this.props ? {className: 'button__content'} : {}}>
<span className="link-label">{this.props.label}</span>, {'icon' in this.props ? <Icon icon={this.props.icon} fixed={true} /> : null}
'badge' in this.props ? <span className="badge">{this.props.badge}</span> : null, {<span className="link-label">{this.props.label}</span>}
]; {'badge' in this.props ? <span className="badge">{this.props.badge}</span> : null}
</span>
);
} }
return ( return (
<a className={className} href={this.props.href || 'javascript:;'} title={this.props.title} <a className={className} href={this.props.href || 'javascript:;'} title={this.props.title}
onClick={this.handleClick} {... 'style' in this.props ? {style: this.props.style} : {}}> onClick={this.handleClick} {... 'style' in this.props ? {style: this.props.style} : {}}>
{'button' in this.props {content}
? <span className="button__content">{content}</span>
: content}
</a> </a>
); );
} }