From bc0238403b70dceb22fa7e90db54fb43ccf33a74 Mon Sep 17 00:00:00 2001 From: Vladimir Volek Date: Mon, 5 Nov 2018 16:45:45 +0100 Subject: [PATCH] Add trezor action to textarea --- src/actions/SignVerifyActions.js | 1 - src/components/Textarea/index.js | 44 +++++++++++++--- src/components/trezorActions/Confirm/index.js | 21 -------- .../Wallet/views/Account/SignVerify/index.js | 51 ++++--------------- 4 files changed, 48 insertions(+), 69 deletions(-) delete mode 100644 src/components/trezorActions/Confirm/index.js diff --git a/src/actions/SignVerifyActions.js b/src/actions/SignVerifyActions.js index 337ed2b0..f823f807 100644 --- a/src/actions/SignVerifyActions.js +++ b/src/actions/SignVerifyActions.js @@ -123,7 +123,6 @@ export const verify = ( } }; - export const clear = (): ThunkAction => (dispatch: Dispatch): void => { dispatch({ type: SIGN_VERIFY.CLEAR, diff --git a/src/components/Textarea/index.js b/src/components/Textarea/index.js index e0f2c8e5..175e0c73 100644 --- a/src/components/Textarea/index.js +++ b/src/components/Textarea/index.js @@ -7,6 +7,7 @@ import { FONT_SIZE, FONT_WEIGHT, FONT_FAMILY } from 'config/variables'; const Wrapper = styled.div` width: 100%; + position: relative; display: flex; flex-direction: column; justify-content: flex-start; @@ -83,7 +84,7 @@ const StyledTextarea = styled(Textarea)` } } - ${props => props.isInTrezorAction && css` + ${props => props.trezorAction && css` z-index: 10001; /* bigger than modal container */ border-color: ${colors.WHITE}; border-width: 2px; @@ -115,6 +116,32 @@ const getColor = (inputState) => { return color; }; +const TrezorAction = styled.div` + align-items: center; + margin: 0px 10px; + padding: 0 14px 0 5px; + position: absolute; + background: black; + bottom: -25px; + color: ${colors.WHITE}; + border-radius: 5px; + line-height: 37px; + z-index: 10001; + transform: translate(-1px, -1px); +`; + +const ArrowUp = styled.div` + position: absolute; + top: -9px; + left: 12px; + width: 0; + height: 0; + border-left: 9px solid transparent; + border-right: 9px solid transparent; + border-bottom: 9px solid black; + z-index: 10001; +`; + const TextArea = ({ className, placeholder = '', @@ -130,11 +157,9 @@ const TextArea = ({ maxRows, state = '', bottomText = '', - isInTrezorAction = false, + trezorAction = null, }) => ( - + {topLabel && ( {topLabel} )} @@ -151,8 +176,13 @@ const TextArea = ({ placeholder={placeholder} onChange={onChange} borderColor={getColor(state)} - isInTrezorAction={isInTrezorAction} + trezorAction={trezorAction} /> + {trezorAction && ( + + {trezorAction} + + )} {bottomText && ( ( - - - Check address on your Trezor - -); - -export default Tooltip; diff --git a/src/views/Wallet/views/Account/SignVerify/index.js b/src/views/Wallet/views/Account/SignVerify/index.js index 400ae343..b1842276 100644 --- a/src/views/Wallet/views/Account/SignVerify/index.js +++ b/src/views/Wallet/views/Account/SignVerify/index.js @@ -53,40 +53,13 @@ const Label = styled.div` padding: 5px 0px 10px 0; `; -const ConfirmTooltip = styled.div` - position: absolute; - z-index: 10001; - padding: 3px 5px; - display: flex; - justify-content: center; - align-items: center; - min-width: 250px; - background: black; - border: 0; - color: ${colors.WHITE}; - border-radius: 5px; - transform: translate(-1px, -1px); -`; - -const ArrowUp = styled.div` - position: absolute; - top: -9px; - left: 20px; - width: 0; - height: 0; - border-left: 9px solid transparent; - border-right: 9px solid transparent; - border-bottom: 9px solid black; - z-index: 10001; -`; - const StyledIcon = styled(Icon)` position: relative; left: 0; `; -const ConfirmText = styled.div` - color: white; +const ActionWrapper = styled.div` + white-space: nowrap `; type State = { @@ -169,18 +142,16 @@ class SignVerify extends Component { rows={4} maxRows={4} maxLength="255" - isInTrezorAction={this.props.isSignProgress} + trezorAction={this.props.isSignProgress ? ( + + + Check address on your Trezor + + ) : null} /> - {this.props.isSignProgress && ( - - - - Check address on your Trezor - - )}