mirror of
https://github.com/trezor/trezor-wallet
synced 2024-12-26 17:08:07 +00:00
Merge pull request #267 from trezor/upgrade-styled-components
Upgraded react, react-dom, styled components, removed styled-media-query
This commit is contained in:
commit
ee28bede6d
@ -49,8 +49,8 @@
|
|||||||
"raf": "^3.4.0",
|
"raf": "^3.4.0",
|
||||||
"raven-js": "^3.22.3",
|
"raven-js": "^3.22.3",
|
||||||
"rc-tooltip": "^3.7.0",
|
"rc-tooltip": "^3.7.0",
|
||||||
"react": "^16.4.2",
|
"react": "^16.6.3",
|
||||||
"react-dom": "^16.2.0",
|
"react-dom": "^16.6.3",
|
||||||
"react-hot-loader": "^4.3.4",
|
"react-hot-loader": "^4.3.4",
|
||||||
"react-json-view": "^1.19.1",
|
"react-json-view": "^1.19.1",
|
||||||
"react-qr-svg": "^2.1.0",
|
"react-qr-svg": "^2.1.0",
|
||||||
@ -67,9 +67,8 @@
|
|||||||
"redux-raven-middleware": "^1.2.0",
|
"redux-raven-middleware": "^1.2.0",
|
||||||
"redux-thunk": "^2.2.0",
|
"redux-thunk": "^2.2.0",
|
||||||
"rimraf": "^2.6.2",
|
"rimraf": "^2.6.2",
|
||||||
"styled-components": "^3.4.9",
|
"styled-components": "^4.1.2",
|
||||||
"styled-media-query": "^2.0.2",
|
"styled-normalize": "^8.0.4",
|
||||||
"styled-normalize": "^8.0.0",
|
|
||||||
"trezor-connect": "6.0.2",
|
"trezor-connect": "6.0.2",
|
||||||
"web3": "1.0.0-beta.35",
|
"web3": "1.0.0-beta.35",
|
||||||
"webpack": "^4.16.3",
|
"webpack": "^4.16.3",
|
||||||
|
@ -176,7 +176,7 @@ class Input extends PureComponent {
|
|||||||
height={this.props.height}
|
height={this.props.height}
|
||||||
trezorAction={this.props.trezorAction}
|
trezorAction={this.props.trezorAction}
|
||||||
hasIcon={this.getIcon(this.props.state).length > 0}
|
hasIcon={this.getIcon(this.props.state).length > 0}
|
||||||
innerRef={this.props.innerRef}
|
ref={this.props.innerRef}
|
||||||
hasAddon={!!this.props.sideAddons}
|
hasAddon={!!this.props.sideAddons}
|
||||||
type={this.props.type}
|
type={this.props.type}
|
||||||
color={this.getColor(this.props.state)}
|
color={this.getColor(this.props.state)}
|
||||||
|
13
src/index.js
13
src/index.js
@ -1,13 +1,20 @@
|
|||||||
/* @flow */
|
/* @flow */
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { render } from 'react-dom';
|
import { render } from 'react-dom';
|
||||||
import baseStyles from 'support/styles';
|
import { Normalize } from 'styled-normalize';
|
||||||
|
import BaseStyles from 'support/styles';
|
||||||
import App from 'views/index';
|
import App from 'views/index';
|
||||||
|
|
||||||
const root: ?HTMLElement = document.getElementById('trezor-wallet-root');
|
const root: ?HTMLElement = document.getElementById('trezor-wallet-root');
|
||||||
if (root) {
|
if (root) {
|
||||||
baseStyles();
|
render(
|
||||||
render(<App />, root);
|
<React.Fragment>
|
||||||
|
<Normalize />
|
||||||
|
<BaseStyles />
|
||||||
|
<App />
|
||||||
|
</React.Fragment>,
|
||||||
|
root,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onbeforeunload = () => {
|
window.onbeforeunload = () => {
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
import { injectGlobal } from 'styled-components';
|
import { createGlobalStyle } from 'styled-components';
|
||||||
import colors from 'config/colors';
|
import colors from 'config/colors';
|
||||||
import normalize from 'styled-normalize';
|
|
||||||
|
|
||||||
import tooltipStyles from './Tooltip';
|
import tooltipStyles from './Tooltip';
|
||||||
import animationStyles from './Animations';
|
import animationStyles from './Animations';
|
||||||
|
|
||||||
const baseStyles = () => injectGlobal`
|
const baseStyles = createGlobalStyle`
|
||||||
${normalize};
|
|
||||||
|
|
||||||
html, body {
|
html, body {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -19,11 +19,8 @@ type State = {
|
|||||||
footerFixed: boolean,
|
footerFixed: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
const AsideWrapper = styled.aside.attrs({
|
const AsideWrapper = styled.aside`
|
||||||
style: ({ minHeight }) => ({
|
min-height: ${props => props.minHeight}px;
|
||||||
minHeight,
|
|
||||||
}),
|
|
||||||
})`
|
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
width: 320px;
|
width: 320px;
|
||||||
@ -33,13 +30,10 @@ const AsideWrapper = styled.aside.attrs({
|
|||||||
border-right: 1px solid ${colors.DIVIDER};
|
border-right: 1px solid ${colors.DIVIDER};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StickyContainerWrapper = styled.div.attrs({
|
const StickyContainerWrapper = styled.div`
|
||||||
style: ({ top, left, paddingBottom }) => ({
|
top: ${props => props.top}px;
|
||||||
top,
|
left: ${props => props.left}px;
|
||||||
left,
|
padding-bottom: ${props => props.paddingBottom}px;
|
||||||
paddingBottom,
|
|
||||||
}),
|
|
||||||
})`
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
border-right: 1px solid ${colors.DIVIDER};
|
border-right: 1px solid ${colors.DIVIDER};
|
||||||
width: 320px;
|
width: 320px;
|
||||||
@ -160,7 +154,7 @@ export default class StickyContainer extends React.PureComponent<Props, State> {
|
|||||||
<AsideWrapper
|
<AsideWrapper
|
||||||
footerFixed={this.state.footerFixed}
|
footerFixed={this.state.footerFixed}
|
||||||
minHeight={this.state.asideMinHeight}
|
minHeight={this.state.asideMinHeight}
|
||||||
innerRef={this.asideRefCallback}
|
ref={this.asideRefCallback}
|
||||||
onScroll={this.handleScroll}
|
onScroll={this.handleScroll}
|
||||||
onTouchStart={this.handleScroll}
|
onTouchStart={this.handleScroll}
|
||||||
onTouchMove={this.handleScroll}
|
onTouchMove={this.handleScroll}
|
||||||
@ -170,11 +164,11 @@ export default class StickyContainer extends React.PureComponent<Props, State> {
|
|||||||
paddingBottom={this.state.wrapperBottomPadding}
|
paddingBottom={this.state.wrapperBottomPadding}
|
||||||
top={this.state.wrapperTopOffset}
|
top={this.state.wrapperTopOffset}
|
||||||
left={this.state.wrapperLeftOffset}
|
left={this.state.wrapperLeftOffset}
|
||||||
innerRef={this.wrapperRefCallback}
|
ref={this.wrapperRefCallback}
|
||||||
>
|
>
|
||||||
{React.Children.map(this.props.children, (child) => { // eslint-disable-line arrow-body-style
|
{React.Children.map(this.props.children, (child) => { // eslint-disable-line arrow-body-style
|
||||||
return child.key === 'sticky-footer' ? React.cloneElement(child, {
|
return child.key === 'sticky-footer' ? React.cloneElement(child, {
|
||||||
innerRef: this.footerRefCallback,
|
ref: this.footerRefCallback,
|
||||||
position: this.state.footerFixed ? 'fixed' : 'relative',
|
position: this.state.footerFixed ? 'fixed' : 'relative',
|
||||||
}) : child;
|
}) : child;
|
||||||
})}
|
})}
|
||||||
|
@ -44,11 +44,8 @@ const TransitionContentWrapper = styled.div`
|
|||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Footer = styled.div.attrs({
|
const Footer = styled.div`
|
||||||
style: ({ position }) => ({
|
position: ${props => props.position};
|
||||||
position,
|
|
||||||
}),
|
|
||||||
})`
|
|
||||||
width: 320px;
|
width: 320px;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background: ${colors.MAIN};
|
background: ${colors.MAIN};
|
||||||
|
@ -61,7 +61,7 @@ class TopNavigationAccount extends React.PureComponent<Props> {
|
|||||||
|
|
||||||
const basePath = `/device/${state.device}/network/${state.network}/account/${state.account}`;
|
const basePath = `/device/${state.device}/network/${state.network}/account/${state.account}`;
|
||||||
return (
|
return (
|
||||||
<Wrapper className="account-tabs" innerRef={this.wrapperRefCallback}>
|
<Wrapper className="account-tabs" ref={this.wrapperRefCallback}>
|
||||||
<StyledNavLink exact to={`${basePath}`}>Summary</StyledNavLink>
|
<StyledNavLink exact to={`${basePath}`}>Summary</StyledNavLink>
|
||||||
<StyledNavLink to={`${basePath}/receive`}>Receive</StyledNavLink>
|
<StyledNavLink to={`${basePath}/receive`}>Receive</StyledNavLink>
|
||||||
<StyledNavLink to={`${basePath}/send`}>Send</StyledNavLink>
|
<StyledNavLink to={`${basePath}/send`}>Send</StyledNavLink>
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { QRCode } from 'react-qr-svg';
|
import { QRCode } from 'react-qr-svg';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import media from 'styled-media-query';
|
|
||||||
|
|
||||||
import { H2 } from 'components/Heading';
|
import { H2 } from 'components/Heading';
|
||||||
import Button from 'components/Button';
|
import Button from 'components/Button';
|
||||||
@ -48,9 +47,9 @@ const ShowAddressButton = styled(Button)`
|
|||||||
border-top-left-radius: 0;
|
border-top-left-radius: 0;
|
||||||
border-bottom-left-radius: 0;
|
border-bottom-left-radius: 0;
|
||||||
|
|
||||||
${media.lessThan('795px')`
|
@media screen and (max-width: 795px) {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
`}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const ShowAddressIcon = styled(Icon)`
|
const ShowAddressIcon = styled(Icon)`
|
||||||
@ -77,9 +76,9 @@ const Row = styled.div`
|
|||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
${media.lessThan('795px')`
|
@media screen and (max-width: 795px) {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
`}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const QrWrapper = styled.div`
|
const QrWrapper = styled.div`
|
||||||
|
Loading…
Reference in New Issue
Block a user