1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Unify tooltip styles

Made a local tooltip component for replicating our tooltip styles wherever we use tooltips.

Applied that tooltip to other items that had tooltips.
This commit is contained in:
Dan Finlay 2016-06-29 16:21:38 -07:00
parent 2b5c42d27f
commit 2880f8631c
4 changed files with 59 additions and 26 deletions

View File

@ -14,6 +14,7 @@ const TransactionList = require('./components/transaction-list')
const ExportAccountView = require('./components/account-export') const ExportAccountView = require('./components/account-export')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const EditableLabel = require('./components/editable-label') const EditableLabel = require('./components/editable-label')
const Tooltip = require('./components/tooltip')
module.exports = connect(mapStateToProps)(AccountDetailScreen) module.exports = connect(mapStateToProps)(AccountDetailScreen)
@ -109,9 +110,16 @@ AccountDetailScreen.prototype.render = function () {
value: ethUtil.toChecksumAddress(selected), value: ethUtil.toChecksumAddress(selected),
}), }),
h(Tooltip, {
title: 'Export Private Key',
}, [
h('div', {
style: {
margin: '5px',
},
}, [
h('img.cursor-pointer.color-orange', { h('img.cursor-pointer.color-orange', {
src: 'images/key-32.png', src: 'images/key-32.png',
title: 'Export Private Key',
onClick: () => this.requestAccountExport(selected), onClick: () => this.requestAccountExport(selected),
style: { style: {
margin: '0px 5px', margin: '0px 5px',
@ -122,6 +130,8 @@ AccountDetailScreen.prototype.render = function () {
right: '4px', right: '4px',
}, },
}), }),
]),
]),
]), ]),

View File

@ -26,6 +26,7 @@ const SandwichExpando = require('sandwich-expando')
const MenuDroppo = require('menu-droppo') const MenuDroppo = require('menu-droppo')
const DropMenuItem = require('./components/drop-menu-item') const DropMenuItem = require('./components/drop-menu-item')
const NetworkIndicator = require('./components/network') const NetworkIndicator = require('./components/network')
const Tooltip = require('./components/tooltip')
module.exports = connect(mapStateToProps)(App) module.exports = connect(mapStateToProps)(App)
@ -152,18 +153,19 @@ App.prototype.renderAppBar = function () {
}, [ }, [
// small accounts nav // small accounts nav
h(Tooltip, { title: 'Switch Accounts' }, [
h('img.cursor-pointer.color-orange', { h('img.cursor-pointer.color-orange', {
src: 'images/switch_acc.svg', src: 'images/switch_acc.svg',
style: { style: {
width: '23.5px', width: '23.5px',
marginRight: '8px', marginRight: '8px',
}, },
title: 'Switch Accounts',
onClick: (event) => { onClick: (event) => {
event.stopPropagation() event.stopPropagation()
this.props.dispatch(actions.showAccountsPage()) this.props.dispatch(actions.showAccountsPage())
}, },
}), }),
]),
// hamburger // hamburger
h(SandwichExpando, { h(SandwichExpando, {

View File

@ -3,7 +3,7 @@ const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const copyToClipboard = require('copy-to-clipboard') const copyToClipboard = require('copy-to-clipboard')
const Tooltip = require('react-tooltip-component') const Tooltip = require('./tooltip')
module.exports = CopyButton module.exports = CopyButton
@ -32,7 +32,6 @@ CopyButton.prototype.render = function () {
}, [ }, [
h(Tooltip, { h(Tooltip, {
position: 'top',
title: message, title: message,
}, [ }, [
h('i.fa.fa-clipboard.cursor-pointer.color-orange', { h('i.fa.fa-clipboard.cursor-pointer.color-orange', {

View File

@ -0,0 +1,22 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
const ReactTooltip = require('react-tooltip-component')
module.exports = Tooltip
inherits(Tooltip, Component)
function Tooltip () {
Component.call(this)
}
Tooltip.prototype.render = function () {
const props = this.props
return h(ReactTooltip, {
position: 'left',
title: props.title,
fixed: false,
}, props.children)
}