/* @flow */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import styled from 'styled-components'; import colors from 'config/colors'; import l10nSendMessages from 'views/Wallet/views/Account/common.messages'; import Input from 'components/inputs/Input'; import Tooltip from 'components/Tooltip'; import Icon from 'components/Icon'; import ICONS from 'config/icons'; import l10nMessages from './index.messages'; import type { Props as BaseProps } from '../../Container'; type Props = BaseProps & { children: React.Node, }; // TODO: Decide on a small screen width for the whole app // and put it inside config/variables.js // same variable also in "AccountSend/index.js" const SmallScreenWidth = '850px'; const InputLabelWrapper = styled.div` display: flex; align-items: center; justify-content: space-between; `; const AdvancedSettingsWrapper = styled.div` padding: 20px 0; display: flex; flex-direction: column; justify-content: space-between; border-top: 1px solid ${colors.DIVIDER}; `; const InputRow = styled.div` width: 100%; display: flex; @media screen and (max-width: ${SmallScreenWidth}) { flex-direction: column; } `; const StyledInput = styled(Input)` /* min-height: 85px; */ padding-bottom: 28px; &:first-child { padding-right: 20px; } @media screen and (max-width: ${SmallScreenWidth}) { &:first-child { padding-right: 0; } } `; const AdvancedSettingsSendButtonWrapper = styled.div` width: 100%; display: flex; justify-content: flex-end; `; const StyledIcon = styled(Icon)` cursor: pointer; `; const getFeeInputState = (feeErrors: string, feeWarnings: string): string => { let state = ''; if (feeWarnings && !feeErrors) { state = 'warning'; } if (feeErrors) { state = 'error'; } return state; }; const getDestinationTagInputState = (errors: string, warnings: string): string => { let state = ''; if (warnings && !errors) { state = 'warning'; } if (errors) { state = 'error'; } return state; }; const Left = styled.div` display: flex; align-items: center; `; // stateless component const AdvancedForm = (props: Props) => { const { network } = props.selectedAccount; if (!network) return null; const { errors, warnings, infos, fee, destinationTag } = props.sendForm; const { onFeeChange, onDestinationTagChange } = props.sendFormActions; return ( } maxWidth={100} readMoreLink="https://developers.ripple.com/transaction-cost.html" placement="top" > } bottomText={errors.fee || warnings.fee || infos.fee} value={fee} onChange={event => onFeeChange(event.target.value)} /> } maxWidth={200} readMoreLink="https://wiki.trezor.io/Ripple_(XRP)" placement="top" > } bottomText={ errors.destinationTag || warnings.destinationTag || infos.destinationTag } value={destinationTag} onChange={event => onDestinationTagChange(event.target.value)} /> {props.children} ); }; export default AdvancedForm;