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

make the back button its own function

This commit is contained in:
Frankie 2016-08-26 11:30:07 -07:00
parent 547894ed39
commit ae33586660

View File

@ -300,28 +300,29 @@ App.prototype.renderDropdown = function () {
}), }),
]) ])
} }
App.prototype.renderBackButton = function (style, justArrow = false) {
var props = this.props
return (
h('.flex-row', {
key: 'leftArrow',
transForward: false,
style: style,
onClick: () => props.dispatch(actions.goBackToInitView()),
}, [
h('i.fa.fa-arrow-left.cursor-pointer'),
justArrow ? null : h('div.cursor-pointer', {
style: {
marginLeft: '3px',
},
onClick: () => props.dispatch(actions.goBackToInitView()),
}, 'BACK'),
])
)
}
App.prototype.renderBackToInitButton = function () { App.prototype.renderBackToInitButton = function () {
var props = this.props var props = this.props
var button = null var button = null
var backButton = function (style, justArrow = false) {
return (
h('.flex-row', {
key: 'leftArrow',
transForward: false,
style: style,
onClick: () => props.dispatch(actions.goBackToInitView()),
}, [
h('i.fa.fa-arrow-left.cursor-pointer'),
justArrow ? null : h('div.cursor-pointer', {
style: {
marginLeft: '3px',
},
onClick: () => props.dispatch(actions.goBackToInitView()),
}, 'BACK'),
])
)
}
if (!props.isUnlocked) { if (!props.isUnlocked) {
if (props.currentView.name === 'InitMenu') { if (props.currentView.name === 'InitMenu') {
button = props.forgottenPassword ? h('.flex-row', { button = props.forgottenPassword ? h('.flex-row', {
@ -357,7 +358,7 @@ App.prototype.renderBackToInitButton = function () {
fontFamily: 'Montserrat Bold', fontFamily: 'Montserrat Bold',
color: 'rgb(174, 174, 174)', color: 'rgb(174, 174, 174)',
} }
return backButton(style, true) return this.renderBackButton(style, true)
case 'restoreVault': case 'restoreVault':
style = { style = {
position: 'absolute', position: 'absolute',
@ -367,7 +368,7 @@ App.prototype.renderBackToInitButton = function () {
fontFamily: 'Montserrat Bold', fontFamily: 'Montserrat Bold',
color: 'rgb(174, 174, 174)', color: 'rgb(174, 174, 174)',
} }
return backButton(style, true) return this.renderBackButton(style, true)
default: default:
style = { style = {
position: 'absolute', position: 'absolute',
@ -379,7 +380,7 @@ App.prototype.renderBackToInitButton = function () {
width: '71.969px', width: '71.969px',
alignItems: 'flex-end', alignItems: 'flex-end',
} }
return backButton(style) return this.renderBackButton(style)
} }
} }
} }