Add support for custom conteint in <Link />
Before you could only specify an icon and text label.
This commit is contained in:
parent
80272ab8f0
commit
a2641c1a98
2 changed files with 19 additions and 8 deletions
|
@ -163,7 +163,7 @@ let FileTile = React.createClass({
|
||||||
<div>
|
<div>
|
||||||
{this.props.metadata.content_type.startsWith('video/') ? <WatchLink streamName={this.props.name} button="primary" /> : null}
|
{this.props.metadata.content_type.startsWith('video/') ? <WatchLink streamName={this.props.name} button="primary" /> : null}
|
||||||
{!this.props.isMine
|
{!this.props.isMine
|
||||||
? <DownloadLink streamName={this.props.name} button="text" {... downloadLinkExtraProps}/>
|
? <DownloadLink streamName={this.props.name} metadata={this.props.metadata} button="text" {... downloadLinkExtraProps}/>
|
||||||
: null}
|
: null}
|
||||||
</div>
|
</div>
|
||||||
<p className="file-tile__description">
|
<p className="file-tile__description">
|
||||||
|
|
|
@ -33,9 +33,12 @@ export let Link = React.createClass({
|
||||||
(!this.props.className && !this.props.button ? 'button-text' : '') +
|
(!this.props.className && !this.props.button ? 'button-text' : '') +
|
||||||
(this.props.disabled ? ' disabled' : '');
|
(this.props.disabled ? ' disabled' : '');
|
||||||
|
|
||||||
return (
|
let content;
|
||||||
<a className={className} href={this.props.href || 'javascript:;'} title={this.props.title}
|
if (this.props.children) { // Custom content
|
||||||
onClick={this.handleClick} {... 'style' in this.props ? {style: this.props.style} : {}}>
|
content = this.props.children;
|
||||||
|
} else {
|
||||||
|
content = (
|
||||||
|
<span>
|
||||||
{'icon' in this.props
|
{'icon' in this.props
|
||||||
? <Icon icon={this.props.icon} fixed={true} />
|
? <Icon icon={this.props.icon} fixed={true} />
|
||||||
: null}
|
: null}
|
||||||
|
@ -43,6 +46,14 @@ export let Link = React.createClass({
|
||||||
{'badge' in this.props
|
{'badge' in this.props
|
||||||
? <span className="badge">{this.props.badge}</span>
|
? <span className="badge">{this.props.badge}</span>
|
||||||
: null}
|
: 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} : {}}>
|
||||||
|
{content}
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue