Add support for custom conteint in <Link />

Before you could only specify an icon and text label.
This commit is contained in:
Alex Liebowitz 2017-01-09 05:43:57 -05:00
parent 80272ab8f0
commit a2641c1a98
2 changed files with 19 additions and 8 deletions

View file

@ -163,7 +163,7 @@ let FileTile = React.createClass({
<div>
{this.props.metadata.content_type.startsWith('video/') ? <WatchLink streamName={this.props.name} button="primary" /> : null}
{!this.props.isMine
? <DownloadLink streamName={this.props.name} button="text" {... downloadLinkExtraProps}/>
? <DownloadLink streamName={this.props.name} metadata={this.props.metadata} button="text" {... downloadLinkExtraProps}/>
: null}
</div>
<p className="file-tile__description">

View file

@ -33,16 +33,27 @@ export let Link = React.createClass({
(!this.props.className && !this.props.button ? 'button-text' : '') +
(this.props.disabled ? ' disabled' : '');
let content;
if (this.props.children) { // Custom content
content = this.props.children;
} else {
content = (
<span>
{'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} : {}}>
{'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}
</a>
);
}