Merge pull request #997 from ethereum/tooltip

Tooltip
pull/1/head
yann300 7 years ago committed by GitHub
commit 971b13e935
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/app/ui/copy-to-clipboard.js
  2. 62
      src/app/ui/tooltip.js

@ -29,7 +29,7 @@ module.exports = function copyToClipboard (getContent) {
}
} catch (e) {}
copy(copiableContent)
addTooltip(event)
addTooltip(event, 'Successfully copied!')
}
}
return copyIcon

@ -6,46 +6,42 @@ var styles = styleGuide.chooser()
var css = csjs`
.tooltip {
visibility: hidden;
width: 100px;
z-index: 1001;
display: inline-block;
position: fixed;
background-color: ${styles.remix.tooltip_CopyToClipboard_BackgroundColor};
color: ${styles.remix.tooltip_CopyToClipboard_Color};
font-weight: bold;
min-height: 50px;
min-width: 290px;
padding: 16px 24px 12px;
border-radius: 3px;
bottom: -300;
left: 40%;
font-size: 12px;
text-transform: initial;
text-align: center;
border-radius: 3px;
padding: 5px 0;
position: absolute;
z-index: 1;
bottom: 160%;
left: 100%;
margin-left: -60px;
opacity: 0;
transition: opacity 1s;
-webkit-animation-name: animatebottom;
-webkit-animation-duration: 6s;
animation-name: animatebottom;
animation-duration: 6s
}
@-webkit-keyframes animatebottom {
0% {bottom: -300px}
20% {bottom: 0}
50% {bottom: 0}
100% {bottom: -300px}
}
.tooltip::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: ${styles.remix.tooltip_CopyToClipboard_BackgroundColor} transparent transparent transparent;
@keyframes animatebottom {
0% {bottom: -300px}
20% {bottom: 0}
50% {bottom: 0}
100% {bottom: -300px}
}
`
module.exports = function addTooltip (event) {
var icon = event.target
icon.style.position = 'relative'
var tooltip = yo`<div class=${css.tooltip}>Copied!</div>`
icon.appendChild(tooltip)
var copiedToolbox = event.target.children[0]
copiedToolbox.style.visibility = 'visible'
copiedToolbox.style.opacity = 1
module.exports = function addTooltip (event, tooltipText) {
var tooltip = yo`<div class=${css.tooltip}>${tooltipText}</div>`
document.body.appendChild(tooltip)
setTimeout(function () {
copiedToolbox.style.visibility = 'hidden'
copiedToolbox.style.opacity = 0
}, 1000)
document.body.removeChild(tooltip)
}, 7000)
}

Loading…
Cancel
Save