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

64 lines
1.4 KiB
JavaScript
Raw Normal View History

2016-08-10 22:43:01 +02:00
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
const connect = require('react-redux').connect
const actions = require('../actions')
module.exports = connect(mapStateToProps)(CoinbaseForm)
2016-11-11 19:26:12 +01:00
function mapStateToProps (state) {
2016-08-10 22:43:01 +02:00
return {
warning: state.appState.warning,
}
}
inherits(CoinbaseForm, Component)
2016-11-11 19:26:12 +01:00
function CoinbaseForm () {
2016-08-10 22:43:01 +02:00
Component.call(this)
}
CoinbaseForm.prototype.render = function () {
var props = this.props
return h('.flex-column', {
style: {
2017-04-24 12:58:01 +02:00
marginTop: '35px',
padding: '25px',
width: '100%',
2016-08-10 22:43:01 +02:00
},
}, [
h('.flex-row', {
style: {
justifyContent: 'space-around',
margin: '33px',
marginTop: '0px',
2016-08-10 22:43:01 +02:00
},
}, [
2017-04-24 12:58:01 +02:00
h('button.btn-green', {
2016-08-10 22:43:01 +02:00
onClick: this.toCoinbase.bind(this),
}, 'Continue to Coinbase'),
2017-04-24 12:58:01 +02:00
h('button.btn-red', {
onClick: () => props.dispatch(actions.backTobuyView(props.accounts.address)),
2016-08-10 22:43:01 +02:00
}, 'Cancel'),
]),
])
}
2017-04-23 19:18:14 +02:00
2016-08-10 22:43:01 +02:00
CoinbaseForm.prototype.toCoinbase = function () {
const props = this.props
const address = props.buyView.buyAddress
props.dispatch(actions.buyEth({ network: '1', address, amount: 0 }))
2016-08-10 22:43:01 +02:00
}
CoinbaseForm.prototype.renderLoading = function () {
return h('img', {
style: {
width: '27px',
marginRight: '-27px',
},
src: 'images/loading.svg',
})
}