aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorChi Kei Chan <chikeichan@gmail.com>2017-10-26 09:49:02 +0800
committerChi Kei Chan <chikeichan@gmail.com>2017-10-26 09:49:02 +0800
commit5aecce908fe74019198ef7fb8626836157d14590 (patch)
treec82b4008be2de4e4805a423717402249b1824999 /ui
parent22d9e3a7e6dfd21b3ea52007030d71f53e29b851 (diff)
parent988dd8fd6105dfe869592ad5238b5d1a80bb8435 (diff)
downloadtangerine-wallet-browser-5aecce908fe74019198ef7fb8626836157d14590.tar.gz
tangerine-wallet-browser-5aecce908fe74019198ef7fb8626836157d14590.tar.zst
tangerine-wallet-browser-5aecce908fe74019198ef7fb8626836157d14590.zip
Merge branch 'master' into NewUI-flat
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/bn-as-decimal-input.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/ui/app/components/bn-as-decimal-input.js b/ui/app/components/bn-as-decimal-input.js
index d84834d06..22e37602e 100644
--- a/ui/app/components/bn-as-decimal-input.js
+++ b/ui/app/components/bn-as-decimal-input.js
@@ -31,6 +31,8 @@ BnAsDecimalInput.prototype.render = function () {
const suffix = props.suffix
const style = props.style
const valueString = value.toString(10)
+ const newMin = min && this.downsize(min.toString(10), scale)
+ const newMax = max && this.downsize(max.toString(10), scale)
const newValue = this.downsize(valueString, scale)
return (
@@ -47,8 +49,8 @@ BnAsDecimalInput.prototype.render = function () {
type: 'number',
step: 'any',
required: true,
- min,
- max,
+ min: newMin,
+ max: newMax,
style: extend({
display: 'block',
textAlign: 'right',
@@ -128,15 +130,17 @@ BnAsDecimalInput.prototype.updateValidity = function (event) {
}
BnAsDecimalInput.prototype.constructWarning = function () {
- const { name, min, max } = this.props
+ const { name, min, max, scale, suffix } = this.props
+ const newMin = min && this.downsize(min.toString(10), scale)
+ const newMax = max && this.downsize(max.toString(10), scale)
let message = name ? name + ' ' : ''
if (min && max) {
- message += `must be greater than or equal to ${min} and less than or equal to ${max}.`
+ message += `must be greater than or equal to ${newMin} ${suffix} and less than or equal to ${newMax} ${suffix}.`
} else if (min) {
- message += `must be greater than or equal to ${min}.`
+ message += `must be greater than or equal to ${newMin} ${suffix}.`
} else if (max) {
- message += `must be less than or equal to ${max}.`
+ message += `must be less than or equal to ${newMax} ${suffix}.`
} else {
message += 'Invalid input.'
}