Fixed problem while copying short URL

This commit is contained in:
Alejandro Celaya 2018-07-21 18:48:33 +02:00
parent 7add153d93
commit 4522443789

View file

@ -116,14 +116,13 @@ class RowMenu extends React.Component {
toggle = () => this.setState({ isOpen: ! this.state.isOpen }); toggle = () => this.setState({ isOpen: ! this.state.isOpen });
render () { render () {
const determineClass = () => { const { display, shortUrl, onCopyToClipboard } = this.props;
const baseClass = 'short-urls-list__dropdown-toggle'; const baseClass = 'short-urls-list__dropdown-toggle';
return ! this.props.display ? `${baseClass} short-urls-list__dropdown-toggle--hidden` : baseClass; const toggleClass = ! display ? `${baseClass} short-urls-list__dropdown-toggle--hidden` : baseClass;
};
return ( return (
<ButtonDropdown toggle={this.toggle} isOpen={this.state.isOpen} direction="left"> <ButtonDropdown toggle={this.toggle} isOpen={this.state.isOpen} direction="left">
<DropdownToggle color="white" size="sm" caret className={determineClass()}> <DropdownToggle color="white" size="sm" caret className={toggleClass}>
&nbsp;<FontAwesomeIcon icon={menuIcon} />&nbsp; &nbsp;<FontAwesomeIcon icon={menuIcon} />&nbsp;
</DropdownToggle> </DropdownToggle>
<DropdownMenu> <DropdownMenu>
@ -138,14 +137,11 @@ class RowMenu extends React.Component {
<FontAwesomeIcon icon={qrIcon} /> &nbsp;QR code <FontAwesomeIcon icon={qrIcon} /> &nbsp;QR code
</DropdownItem> </DropdownItem>
<DropdownItem divider /> <DropdownItem divider />
<DropdownItem> <CopyToClipboard text={shortUrl} onCopy={onCopyToClipboard}>
<CopyToClipboard text={this.props.shortUrl} onCopy={this.props.onCopyToClipboard}> <DropdownItem>
<span><FontAwesomeIcon icon={copyIcon} /> &nbsp;Copy to clipboard</span> <FontAwesomeIcon icon={copyIcon} /> &nbsp;Copy to clipboard
</CopyToClipboard> </DropdownItem>
</DropdownItem> </CopyToClipboard>
{/*<DropdownItem tag={CopyToClipboard} text={this.props.shortUrl} onCopy={this.props.onCopyToClipboard}>*/}
{/*<span><FontAwesomeIcon icon={copyIcon} /> &nbsp;Copy to clipboard</span>*/}
{/*</DropdownItem>*/}
</DropdownMenu> </DropdownMenu>
</ButtonDropdown> </ButtonDropdown>
); );