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>
|
||||
{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">
|
||||
|
|
|
@ -33,9 +33,12 @@ export let Link = React.createClass({
|
|||
(!this.props.className && !this.props.button ? 'button-text' : '') +
|
||||
(this.props.disabled ? ' disabled' : '');
|
||||
|
||||
return (
|
||||
<a className={className} href={this.props.href || 'javascript:;'} title={this.props.title}
|
||||
onClick={this.handleClick} {... 'style' in this.props ? {style: this.props.style} : {}}>
|
||||
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}
|
||||
|
@ -43,6 +46,14 @@ export let Link = React.createClass({
|
|||
{'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} : {}}>
|
||||
{content}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue