-
Notifications
You must be signed in to change notification settings - Fork 33
feat: Fixes #308. Change amount font size on Send page to fit in input field #321
Conversation
…t field * Switches to font size that fits a value as small as 1 Wei on the screen when more than 9 digits entered * Switches back to default font size when amount of digits entered is 9 or less again * Caters for when user unchecks the Max Value button
@@ -61,6 +65,23 @@ class Send extends Component { | |||
} | |||
}); | |||
|
|||
changeAmountFontSize = () => { | |||
const amountElement = document.getElementById('amount'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No! React uses its own virtual DOM, so we never directly modify the DOM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been looking into this but had difficulties using refs. I've also tried controlled components, and mutators unsuccessfully so far
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An idea: on <Field name="amount">
, in its className field, you can add a CSS class when the values.amount
's length is longer than some value.
@amaurymartiny I've pushed a commit that addresses your review comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3 Thanks!
I've merged latest from master and fixed conflicts |
@@ -42,6 +44,13 @@ class Send extends Component { | |||
showDetails: false | |||
}; | |||
|
|||
handleSubmit = values => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert. handleSubmit is already somewhere else in the class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Switches to font size that fits a value as small as 1 Wei on the screen when more than 9 digits entered
Switches back to default font size when amount of digits entered is 9 or less again
Caters for when user unchecks the Max Value button