/* @flow */ import React, { Component } from 'react'; import styled from 'styled-components'; import { Input, TextArea, Button, colors } from 'trezor-ui-components'; import Title from 'views/Wallet/components/Title'; import Content from 'views/Wallet/components/Content'; import { SCREEN_SIZE } from 'config/variables'; import { FormattedMessage } from 'react-intl'; import l10nCommonMessages from 'views/common.messages'; import l10nMessages from './index.messages'; import type { Props } from './Container'; const Wrapper = styled.div` display: flex; flex: 1; flex-direction: row; background: ${colors.WHITE}; @media screen and (max-width: ${SCREEN_SIZE.MD}) { flex-wrap: wrap; } `; const Row = styled.div` padding-bottom: 28px; `; const RowButtons = styled(Row)` display: flex; align-items: center; justify-content: flex-end; `; const StyledButton = styled(Button)` width: 110px; margin-left: 10px; &:first-child { margin-left: 0; } `; const Column = styled.div` display: flex; flex: 1 1 auto; flex-direction: column; @media screen and (max-width: ${SCREEN_SIZE.MD}) { flex: 1 1 100%; } `; const Sign = styled(Column)``; const Verify = styled(Column)` padding-left: 20px; @media screen and (max-width: ${SCREEN_SIZE.MD}) { padding-left: 0px; } `; class SignVerify extends Component { getError(inputName: string) { if (!this.props.signVerify) return null; return this.props.signVerify.errors.find(e => e.inputName === inputName); } handleInputChange = (event: SyntheticInputEvent) => { this.props.signVerifyActions.inputChange(event.target.name, event.target.value); }; render() { const device = this.props.wallet.selectedDevice; const { account, discovery, shouldRender } = this.props.selectedAccount; if (!device || !account || !discovery || !shouldRender) { const { loader, exceptionPage } = this.props.selectedAccount; return ; } const { signVerifyActions, signVerify: { signMessage, signSignature, verifyAddress, verifyMessage, verifySignature, errors, }, } = this.props; const verifyAddressError = this.getError('verifyAddress'); return ( <FormattedMessage {...l10nMessages.TR_SIGN_MESSAGE} />