Hide caret on "Downloading" dropdown when download hasn't actually started

This commit is contained in:
Alex Liebowitz 2017-01-10 03:10:36 -05:00
parent 802d8c6777
commit b524eec826

View file

@ -114,6 +114,12 @@ export let ToolTipLink = React.createClass({
export let DropDown = React.createClass({ export let DropDown = React.createClass({
propTypes: { propTypes: {
onCaretClick: React.PropTypes.func, onCaretClick: React.PropTypes.func,
showCaret: React.PropTypes.bool,
},
getDefaultProps: function() {
return {
showCaret: true,
};
}, },
handleCaretClicked: function(event) { handleCaretClicked: function(event) {
/** /**
@ -142,7 +148,9 @@ export let DropDown = React.createClass({
<div> <div>
<Link {...other}> <Link {...other}>
<span className="link-label">{this.props.label}</span> <span className="link-label">{this.props.label}</span>
<Icon icon="icon-caret-down" fixed={true} onClick={this.handleCaretClicked} /> {this.props.showCaret
? <Icon icon="icon-caret-down" fixed={true} onClick={this.handleCaretClicked} />
: null}
</Link> </Link>
{this.state.menuOpen {this.state.menuOpen
? <Menu onClickOut={this.closeMenu}> ? <Menu onClickOut={this.closeMenu}>
@ -262,11 +270,12 @@ export let DownloadLink = React.createClass({
linkBlock = ( linkBlock = (
<span> <span>
<DropDown button="download" className="button-download--bg" label={label} icon="icon-download" <DropDown button="download" className="button-download--bg" label={label} icon="icon-download"
onClick={this.handleClick}> onClick={this.handleClick} showCaret={!this.state.attemptingDownload}>
{dropDownItems} {dropDownItems}
</DropDown> </DropDown>
<DropDown button="download" className="button-download--fg" label={label} icon="icon-download" <DropDown button="download" className="button-download--fg" label={label} icon="icon-download"
onClick={this.handleClick} style={{width: `${progress * 100}%`}}> onClick={this.handleClick} showCaret={!this.state.attemptingDownload}
style={{width: `${progress * 100}%`}}>
{dropDownItems} {dropDownItems}
</DropDown> </DropDown>
</span> </span>