mirror of
https://github.com/trezor/trezor-wallet
synced 2025-08-02 11:58:37 +00:00
Merge branch 'styled-components-refactor' of github.com:satoshilabs/trezor-wallet into styled-components-refactor
This commit is contained in:
commit
0c4ce2a850
@ -18,7 +18,7 @@ const Wrapper = styled.div`
|
|||||||
display: flex;
|
display: flex;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const LinkWrapper = styled(Link)`
|
const StyledLink = styled(Link)`
|
||||||
margin: 0 6px;
|
margin: 0 6px;
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
`;
|
`;
|
||||||
@ -30,9 +30,9 @@ const Copy = styled.div`
|
|||||||
const Footer = ({ toggle }) => (
|
const Footer = ({ toggle }) => (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<Copy>© {getYear(new Date())}</Copy>
|
<Copy>© {getYear(new Date())}</Copy>
|
||||||
<LinkWrapper href="http://satoshilabs.com" target="_blank" rel="noreferrer noopener" className="satoshi" isGreen>SatoshiLabs</LinkWrapper>
|
<StyledLink href="http://satoshilabs.com" target="_blank" rel="noreferrer noopener" className="satoshi" isGreen>SatoshiLabs</StyledLink>
|
||||||
<LinkWrapper href="tos.pdf" target="_blank" rel="noreferrer noopener" isGreen>Terms</LinkWrapper>
|
<StyledLink href="tos.pdf" target="_blank" rel="noreferrer noopener" isGreen>Terms</StyledLink>
|
||||||
<LinkWrapper onClick={toggle} isGreen>Show Log</LinkWrapper>
|
<StyledLink onClick={toggle} isGreen>Show Log</StyledLink>
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* @flow */
|
/* @flow */
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import Link from 'components/Link';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import colors from 'config/colors';
|
import colors from 'config/colors';
|
||||||
@ -32,7 +33,7 @@ const LayoutWrapper = styled.div`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const A = styled.a`
|
const A = styled(Link)`
|
||||||
color: ${colors.WHITE};
|
color: ${colors.WHITE};
|
||||||
margin-left: 24px;
|
margin-left: 24px;
|
||||||
|
|
||||||
|
@ -59,6 +59,11 @@ const Wrapper = styled.div`
|
|||||||
|
|
||||||
const InputWrapper = styled.div``;
|
const InputWrapper = styled.div``;
|
||||||
|
|
||||||
|
const InputLabel = styled.span`
|
||||||
|
padding-bottom: 4px;
|
||||||
|
color: ${colors.TEXT_SECONDARY};
|
||||||
|
`;
|
||||||
|
|
||||||
const ErrorLabel = styled.span`
|
const ErrorLabel = styled.span`
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
font-size: ${FONT_SIZE.SMALLER};
|
font-size: ${FONT_SIZE.SMALLER};
|
||||||
@ -71,9 +76,24 @@ const StyledIcon = styled(Icon)`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const Input = ({
|
const Input = ({
|
||||||
type, autoComplete, placeholder, autoCorrect, autoCapitalize, spellCheck, value, onChange, isSuccess, isWarning, isError, errorText,
|
type,
|
||||||
|
autoComplete,
|
||||||
|
placeholder,
|
||||||
|
autoCorrect,
|
||||||
|
autoCapitalize,
|
||||||
|
spellCheck,
|
||||||
|
value,
|
||||||
|
onChange,
|
||||||
|
isSuccess,
|
||||||
|
isWarning,
|
||||||
|
isError,
|
||||||
|
errorText,
|
||||||
|
inputLabel,
|
||||||
}) => (
|
}) => (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
|
{inputLabel && (
|
||||||
|
<InputLabel>{inputLabel}</InputLabel>
|
||||||
|
)}
|
||||||
<InputWrapper>
|
<InputWrapper>
|
||||||
<StyledInput
|
<StyledInput
|
||||||
type={type}
|
type={type}
|
||||||
@ -128,6 +148,7 @@ Input.propTypes = {
|
|||||||
isWarning: PropTypes.bool,
|
isWarning: PropTypes.bool,
|
||||||
isError: PropTypes.bool,
|
isError: PropTypes.bool,
|
||||||
errorText: PropTypes.string,
|
errorText: PropTypes.string,
|
||||||
|
inputLabel: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Input;
|
export default Input;
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import type { Props } from './index';
|
|
||||||
|
|
||||||
const InvalidPin = (props: Props) => {
|
|
||||||
if (!props.modal.opened) return null;
|
|
||||||
|
|
||||||
const { device } = props.modal;
|
|
||||||
return (
|
|
||||||
<div className="pin">
|
|
||||||
<h3>Entered PIN for { device.label } is not correct</h3>
|
|
||||||
<p>Retrying...</p>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default InvalidPin;
|
|
@ -1,20 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import type { Props } from './index';
|
|
||||||
|
|
||||||
const Confirmation = (props: Props) => {
|
|
||||||
if (!props.modal.opened) return null;
|
|
||||||
const { device } = props.modal;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="confirm-tx">
|
|
||||||
<div className="header">
|
|
||||||
<h3>Complete the action on { device.label } device</h3>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Confirmation;
|
|
@ -17,10 +17,11 @@ import * as CONNECT from 'actions/constants/TrezorConnect';
|
|||||||
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
|
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
|
||||||
import type { State, Dispatch } from 'flowtype';
|
import type { State, Dispatch } from 'flowtype';
|
||||||
|
|
||||||
import Pin from 'components/modals/Pin';
|
import Pin from 'components/modals/pin/Pin';
|
||||||
import InvalidPin from 'components/modals/InvalidPin';
|
import InvalidPin from 'components/modals/pin/Invalid';
|
||||||
import Passphrase from 'components/modals/Passphrase';
|
|
||||||
import PassphraseType from 'components/modals/PassphraseType';
|
import Passphrase from 'components/modals/passphrase/Passphrase';
|
||||||
|
import PassphraseType from 'components/modals/passphrase/Type';
|
||||||
|
|
||||||
import ConfirmSignTx from 'components/modals/confirm/SignTx';
|
import ConfirmSignTx from 'components/modals/confirm/SignTx';
|
||||||
import ConfirmUnverifiedAddress from 'components/modals/confirm/UnverifiedAddress';
|
import ConfirmUnverifiedAddress from 'components/modals/confirm/UnverifiedAddress';
|
||||||
@ -52,7 +53,6 @@ export type Props = StateProps & DispatchProps;
|
|||||||
|
|
||||||
const duration = 300;
|
const duration = 300;
|
||||||
|
|
||||||
|
|
||||||
const Fade = ({ children, ...props }) => (
|
const Fade = ({ children, ...props }) => (
|
||||||
<CSSTransition
|
<CSSTransition
|
||||||
{...props}
|
{...props}
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
/* @flow */
|
/* @flow */
|
||||||
|
|
||||||
|
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import raf from 'raf';
|
import raf from 'raf';
|
||||||
|
|
29
src/components/modals/passphrase/Type/index.js
Normal file
29
src/components/modals/passphrase/Type/index.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Icon from 'components/Icon';
|
||||||
|
import colors from 'config/colors';
|
||||||
|
import icons from 'config/icons';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import { H3 } from 'components/Heading';
|
||||||
|
|
||||||
|
const Wrapper = styled.div`
|
||||||
|
width: 360px;
|
||||||
|
padding: 24px 48px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const Header = styled.div``;
|
||||||
|
|
||||||
|
const Confirmation = (props) => {
|
||||||
|
if (!props.modal.opened) return null;
|
||||||
|
const { device } = props.modal;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Wrapper>
|
||||||
|
<Header>
|
||||||
|
<Icon icon={icons.T1} size={60} color={colors.TEXT_SECONDARY} />
|
||||||
|
<H3>Complete the action on { device.label } device</H3>
|
||||||
|
</Header>
|
||||||
|
</Wrapper>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Confirmation;
|
24
src/components/modals/pin/Invalid/index.js
Normal file
24
src/components/modals/pin/Invalid/index.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import { H3 } from 'components/Heading';
|
||||||
|
import P from 'components/Paragraph';
|
||||||
|
|
||||||
|
import type { Props } from './index';
|
||||||
|
|
||||||
|
const Wrapper = styled.div`
|
||||||
|
padding: 24px 48px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const InvalidPin = (props: Props) => {
|
||||||
|
if (!props.modal.opened) return null;
|
||||||
|
|
||||||
|
const { device } = props.modal;
|
||||||
|
return (
|
||||||
|
<Wrapper>
|
||||||
|
<H3>Entered PIN for { device.label } is not correct</H3>
|
||||||
|
<P isSmaller>Retrying...</P>
|
||||||
|
</Wrapper>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default InvalidPin;
|
@ -2,13 +2,17 @@
|
|||||||
|
|
||||||
|
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import colors from 'config/colors';
|
||||||
import type { Props } from './index';
|
import type { Props } from './index';
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
pin: string;
|
pin: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Wrapper = styled.div``;
|
||||||
|
const InputRow = styled.div``;
|
||||||
|
|
||||||
export default class Pin extends Component<Props, State> {
|
export default class Pin extends Component<Props, State> {
|
||||||
keyboardHandler: (event: KeyboardEvent) => void;
|
keyboardHandler: (event: KeyboardEvent) => void;
|
||||||
|
|
||||||
@ -111,7 +115,7 @@ export default class Pin extends Component<Props, State> {
|
|||||||
const { pin } = this.state;
|
const { pin } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="pin">
|
<Wrapper className="pin">
|
||||||
{/* <button className="close-modal transparent"></button> */}
|
{/* <button className="close-modal transparent"></button> */}
|
||||||
<h3>Enter { device.label } PIN</h3>
|
<h3>Enter { device.label } PIN</h3>
|
||||||
<p>The PIN layout is displayed on your TREZOR.</p>
|
<p>The PIN layout is displayed on your TREZOR.</p>
|
||||||
@ -139,7 +143,7 @@ export default class Pin extends Component<Props, State> {
|
|||||||
|
|
||||||
<div><button className="submit" type="button" onClick={event => onPinSubmit(pin)}>Enter PIN</button></div>
|
<div><button className="submit" type="button" onClick={event => onPinSubmit(pin)}>Enter PIN</button></div>
|
||||||
<p>Not sure how PIN works? <a className="green" href="http://doc.satoshilabs.com/trezor-user/enteringyourpin.html" target="_blank" rel="noreferrer noopener">Learn more</a></p>
|
<p>Not sure how PIN works? <a className="green" href="http://doc.satoshilabs.com/trezor-user/enteringyourpin.html" target="_blank" rel="noreferrer noopener">Learn more</a></p>
|
||||||
</div>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -87,9 +87,15 @@ class AccountBalance extends Component<Props, State> {
|
|||||||
const selectedCoin = this.props.coin;
|
const selectedCoin = this.props.coin;
|
||||||
const fiatRate: any = this.props.fiat.find(f => f.network === selectedCoin.network);
|
const fiatRate: any = this.props.fiat.find(f => f.network === selectedCoin.network);
|
||||||
|
|
||||||
const accountBalance = new BigNumber(this.props.balance);
|
let accountBalance = '';
|
||||||
const fiatRateValue = new BigNumber(fiatRate.value);
|
let fiatRateValue = '';
|
||||||
const fiat = accountBalance.times(fiatRateValue).toFixed(2);
|
let fiat = '';
|
||||||
|
if (fiatRate) {
|
||||||
|
accountBalance = new BigNumber(this.props.balance);
|
||||||
|
fiatRateValue = new BigNumber(fiatRate.value);
|
||||||
|
fiat = accountBalance.times(fiatRateValue).toFixed(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
|
Loading…
Reference in New Issue
Block a user