/* @flow */ import React, { PureComponent } from 'react'; import styled, { keyframes } from 'styled-components'; import TrezorConnect from 'trezor-connect'; import P from 'components/Paragraph'; import Button from 'components/Button'; import { H2 } from 'components/Heading'; import { PULSATE } from 'config/animations'; import colors from 'config/colors'; import { FONT_SIZE, FONT_WEIGHT } from 'config/variables'; import CaseImage from 'images/macbook.png'; import Link from 'components/Link'; type Props = { deviceLabel: string, showWebUsb: boolean, showDisconnect: boolean, }; const Title = styled.div` margin-top: 60px; `; const Wrapper = styled.div` display: flex; justify-content: space-around; align-items: center; width: 400px; margin: 0 auto; padding: 36px 0; `; const ConnectTrezorWrapper = styled.div` position: relative; top: 1px; animation: ${PULSATE} 1.3s ease-out infinite; color: ${colors.GREEN_PRIMARY}; font-size: ${FONT_SIZE.BASE}; font-weight: ${FONT_WEIGHT.BASE}; `; const Image = styled.img` width: 777px; min-height: 500px; margin: auto; background-repeat: no-repeat; background-position: center 0px; background-size: contain; `; const Footer = styled.div` margin-bottom: 32px; `; const FooterText = styled.span` margin-right: 4px; `; const StyledLink = styled(Link)` font-size: ${FONT_SIZE.BASE}; `; class ConnectDevice extends PureComponent { componentDidMount() { if (this.props.showWebUsb) { TrezorConnect.renderWebUSBButton(); } } componentDidUpdate() { if (this.props.showWebUsb) { TrezorConnect.renderWebUSBButton(); } } getTrezorDeviceImage() { const animationConnect = keyframes` 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-4px) } `; const ImageWrapper = styled.svg` position: absolute; top: -8px; left: -24px; `; const DeviceRect = styled.rect` animation: ${animationConnect} 1.3s ease-out infinite; `; return ( ); } render() { return (
<H2 claim>The private bank in your hands.</H2> <P>Trezor Wallet is an easy-to-use interface for your Trezor.</P> <P>Trezor Wallet allows you to easily control your funds, manage your balance and initiate transfers.</P> {this.props.showDisconnect && `Unplug "${this.props.deviceLabel}" device`} {!this.props.showDisconnect && ( {this.getTrezorDeviceImage()} Connect Trezor )} {this.props.showWebUsb && !this.props.showDisconnect && (

and

)}
); } } export default ConnectDevice;