From 0064c2dee4e65b64f6e1c4d963d6530c472ad55f Mon Sep 17 00:00:00 2001 From: BTCln Date: Sun, 20 Jan 2019 22:53:44 -0500 Subject: [PATCH] Improvements to Number Pad buttons on Enter Amount screen. --- src/assets/scss/keypad.scss | 9 +-------- src/components/KeyPad.jsx | 9 ++++++--- src/components/KeyPadButtons.jsx | 26 ++++++++++++++++---------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/assets/scss/keypad.scss b/src/assets/scss/keypad.scss index 8b10016..081ae58 100644 --- a/src/assets/scss/keypad.scss +++ b/src/assets/scss/keypad.scss @@ -19,18 +19,11 @@ grid-template-columns: repeat(4, 1fr); } .keypad-button { - &.clear { - background-color: red; - } - &.delete { - background-color: yellow; - } &.enter { grid-row: 3 / 5; grid-column: 4; - background-color: green; } - padding: 10px; + padding: 0px; font-size: 28px; font-weight: 500; background: #eee; diff --git a/src/components/KeyPad.jsx b/src/components/KeyPad.jsx index 5853bd0..89e9226 100644 --- a/src/components/KeyPad.jsx +++ b/src/components/KeyPad.jsx @@ -12,9 +12,12 @@ export default class KeyPad extends Component { handleKeyPress(value) { const { text } = this.state; const { onSubmit } = this.props; - if (value === 'enter' && text.length > 0) { - onSubmit(parseFloat(text)); - return this.setState({ text: '' }); + if (value === 'enter') { + if (text.length > 0) { + onSubmit(parseFloat(text)); + return this.setState({ text: '' }); + } + return null; } if (value === 'clear') { return this.setState({ text: '' }); diff --git a/src/components/KeyPadButtons.jsx b/src/components/KeyPadButtons.jsx index 6f3b39f..e791206 100644 --- a/src/components/KeyPadButtons.jsx +++ b/src/components/KeyPadButtons.jsx @@ -1,18 +1,24 @@ import React, { Component } from 'react'; +import { AnchorButton, ButtonGroup } from '@blueprintjs/core'; export default class KeyPadButtons extends Component { shouldComponentUpdate() { return false; } - renderButton(value, { content, className = '' } = {}) { + + renderButton(value, { content, className = '', intent } = {}) { const { onKeyPress } = this.props; return ( -
onKeyPress(value)} - > - {content || value} +
+ + onKeyPress(value)} + fill + intent={intent} + /> +
); } @@ -22,18 +28,18 @@ export default class KeyPadButtons extends Component { {this.renderButton('7')} {this.renderButton('8')} {this.renderButton('9')} - {this.renderButton('clear', { content: 'Clear', className: 'clear'})} + {this.renderButton('clear', { content: 'Clear', intent: 'danger' })} {this.renderButton('4')} {this.renderButton('5')} {this.renderButton('6')} - {this.renderButton('delete', { content: 'Delete', className: 'delete'})} + {this.renderButton('delete', { content: 'Delete', intent: 'warning' })} {this.renderButton('1')} {this.renderButton('2')} {this.renderButton('3')} {this.renderButton('0')} {this.renderButton('00')} {this.renderButton('.')} - {this.renderButton('enter', { content: 'OK', className: 'enter' })} + {this.renderButton('enter', { content: 'OK', className: 'enter', intent: 'success' }) }
); }