Add tooltipText param to tooltip module and move tooltip to the left and make it wider

pull/3094/head
ninabreznik 7 years ago committed by yann300
parent aff0b7512a
commit 4ea6900780
  1. 2
      src/app/ui/copy-to-clipboard.js
  2. 12
      src/app/ui/tooltip.js

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

@ -7,11 +7,11 @@ var styles = styleGuide.chooser()
var css = csjs` var css = csjs`
.tooltip { .tooltip {
visibility: hidden; visibility: hidden;
width: 100px; width: 175px;
background-color: ${styles.remix.tooltip_CopyToClipboard_BackgroundColor}; background-color: ${styles.remix.tooltip_CopyToClipboard_BackgroundColor};
color: ${styles.remix.tooltip_CopyToClipboard_Color}; color: ${styles.remix.tooltip_CopyToClipboard_Color};
font-weight: bold; font-weight: bold;
font-size: 12px; font-size: 10px;
text-transform: initial; text-transform: initial;
text-align: center; text-align: center;
border-radius: 3px; border-radius: 3px;
@ -20,7 +20,7 @@ var css = csjs`
z-index: 1; z-index: 1;
bottom: 160%; bottom: 160%;
left: 100%; left: 100%;
margin-left: -60px; margin-left: -150px;
opacity: 0; opacity: 0;
transition: opacity 1s; transition: opacity 1s;
} }
@ -28,7 +28,7 @@ var css = csjs`
content: ""; content: "";
position: absolute; position: absolute;
top: 100%; top: 100%;
left: 50%; right: 10%;
margin-left: -5px; margin-left: -5px;
border-width: 5px; border-width: 5px;
border-style: solid; border-style: solid;
@ -36,10 +36,10 @@ var css = csjs`
} }
` `
module.exports = function addTooltip (event) { module.exports = function addTooltip (event, tooltipText) {
var icon = event.target var icon = event.target
icon.style.position = 'relative' icon.style.position = 'relative'
var tooltip = yo`<div class=${css.tooltip}>Copied!</div>` var tooltip = yo`<div class=${css.tooltip}>${tooltipText}</div>`
icon.appendChild(tooltip) icon.appendChild(tooltip)
var copiedToolbox = event.target.children[0] var copiedToolbox = event.target.children[0]
copiedToolbox.style.visibility = 'visible' copiedToolbox.style.visibility = 'visible'

Loading…
Cancel
Save