Add trezor webusb button style

pull/8/head
Vasek Mlejnsky 6 years ago
parent 4644c6d1bc
commit 6946500f0a

@ -3,6 +3,7 @@ import styled, { css } from 'styled-components';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Icon from 'components/Icon'; import Icon from 'components/Icon';
import colors from 'config/colors'; import colors from 'config/colors';
import { TRANSITION } from 'config/variables';
const Wrapper = styled.button` const Wrapper = styled.button`
padding: ${props => (props.icon ? '4px 24px 4px 15px' : '11px 24px')}; padding: ${props => (props.icon ? '4px 24px 4px 15px' : '11px 24px')};
@ -24,6 +25,55 @@ const Wrapper = styled.button`
color: ${colors.TEXT_SECONDARY}; color: ${colors.TEXT_SECONDARY};
background: ${colors.GRAY_LIGHT}; background: ${colors.GRAY_LIGHT};
`} `}
${props => props.isWebUsb && css`
position: relative;
padding: 12px 24px 12px 40px;
background: transparent;
color: ${colors.GREEN_PRIMARY};
border: 1px solid ${colors.GREEN_PRIMARY};
transition: ${TRANSITION.HOVER};
&:before,
&:after {
content: '';
position: absolute;
background: ${colors.GREEN_PRIMARY};
top: 0;
bottom: 0;
margin: auto;
transition: ${TRANSITION.HOVER};
}
&:before {
width: 12px;
height: 2px;
left: 18px;
}
&:after {
width: 2px;
height: 12px;
left: 23px;
}
&:hover {
background: ${colors.GREEN_PRIMARY};
color: ${colors.WHITE};
&:before,
&:after {
background: ${colors.WHITE};
}
}
iframe {
position: absolute;
top: 0;
left: 0;
z-index: 1;
}
`}
`; `;
const IconWrapper = styled.span` const IconWrapper = styled.span`
@ -31,14 +81,16 @@ const IconWrapper = styled.span`
`; `;
const Button = ({ const Button = ({
text, icon, onClick, disabled, blue, white, className, text, icon, onClick = () => { }, disabled, isBlue = false, isWhite = false, isWebUsb = false,
}) => ( }) => (
<Wrapper <Wrapper
className={className}
icon={icon} icon={icon}
onClick={onClick} onClick={onClick}
disabled={disabled} disabled={disabled}
blue={blue} isBlue={isBlue}
white={white} isWhite={isWhite}
isWebUsb={isWebUsb}
> >
{icon && ( {icon && (
<IconWrapper> <IconWrapper>
@ -54,10 +106,12 @@ const Button = ({
); );
Button.propTypes = { Button.propTypes = {
className: PropTypes.string,
onClick: PropTypes.func, onClick: PropTypes.func,
disabled: PropTypes.bool, disabled: PropTypes.bool,
blue: PropTypes.bool, isBlue: PropTypes.bool,
white: PropTypes.bool, isWhite: PropTypes.bool,
isWebUsb: PropTypes.bool,
icon: PropTypes.shape({ icon: PropTypes.shape({
type: PropTypes.arrayOf(PropTypes.string).isRequired, type: PropTypes.arrayOf(PropTypes.string).isRequired,
color: PropTypes.string, color: PropTypes.string,
@ -66,11 +120,4 @@ Button.propTypes = {
text: PropTypes.string.isRequired, text: PropTypes.string.isRequired,
}; };
Button.defaultProps = {
onClick: () => {},
disabled: false,
blue: false,
white: false,
};
export default Button; export default Button;

@ -4,6 +4,7 @@ import React, { Component } from 'react';
import styled, { keyframes } from 'styled-components'; import styled, { keyframes } from 'styled-components';
import TrezorConnect from 'trezor-connect'; import TrezorConnect from 'trezor-connect';
import P from 'components/Paragraph'; import P from 'components/Paragraph';
import Button from 'components/Button';
import colors from 'config/colors'; import colors from 'config/colors';
import { FONT_SIZE, FONT_WEIGHT } from 'config/variables'; import { FONT_SIZE, FONT_WEIGHT } from 'config/variables';
@ -97,12 +98,11 @@ class ConnectDevice extends Component<Props> {
{this.props.showWebUsb && ( {this.props.showWebUsb && (
<React.Fragment> <React.Fragment>
<P>and</P> <P>and</P>
<button <Button
type="button"
className="trezor-webusb-button" className="trezor-webusb-button"
> text="Check for devices"
Check for devices isWebUsb
</button> />
</React.Fragment> </React.Fragment>
)} )}
</Wrapper> </Wrapper>

Loading…
Cancel
Save