mirror of
https://github.com/desktop/desktop
synced 2024-09-20 00:21:23 +00:00
Make copy button tooltip appear on click
This commit is contained in:
parent
4787048bd1
commit
5a3f312ff3
|
@ -32,7 +32,7 @@ export class CopyButton extends React.Component<
|
|||
|
||||
this.setState({ showCopied: true })
|
||||
|
||||
await sleep(1500)
|
||||
await sleep(2000)
|
||||
|
||||
this.setState({ showCopied: false })
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ export class CopyButton extends React.Component<
|
|||
tooltip={showCopied ? 'Copied!' : ariaLabel}
|
||||
ariaLabel={ariaLabel}
|
||||
onClick={this.onCopy}
|
||||
isToggleTip={true}
|
||||
>
|
||||
{this.renderSymbol()}
|
||||
</Button>
|
||||
|
|
|
@ -154,6 +154,9 @@ export interface IButtonProps {
|
|||
|
||||
/** Specify custom classes for the button's tooltip */
|
||||
readonly tooltipClassName?: string
|
||||
|
||||
/** Whether the button acts as a toggle tip and shows the toolitp on click */
|
||||
readonly isToggleTip?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -222,6 +225,7 @@ export class Button extends React.Component<IButtonProps, {}> {
|
|||
// Show the tooltip immediately on hover if the button is disabled
|
||||
delay={disabled ? 0 : undefined}
|
||||
onlyWhenOverflowed={this.props.onlyShowTooltipWhenOverflowed}
|
||||
isToggleTip={this.props.isToggleTip}
|
||||
>
|
||||
{tooltip}
|
||||
</Tooltip>
|
||||
|
|
Loading…
Reference in a new issue