Simplify content wrapping logic in Link
This commit is contained in:
parent
b2fd38a1c8
commit
ef393ca360
1 changed files with 8 additions and 8 deletions
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue