1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-01-15 18:41:12 +00:00

Added image preloader

This commit is contained in:
Vladimir Volek 2018-11-06 13:15:12 +01:00 committed by Szymon Lesisz
parent a114b47b77
commit 72b5120bbc
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,25 @@
import React, { Component } from 'react';
import styled from 'styled-components';
const Wrapper = styled.div`
display: none;
`;
const Img = styled.img``;
class ImagesPreloader extends Component {
importAll(r) {
return r.keys().map(r);
}
render() {
const images = this.importAll(require.context('../images', false, /\.(png|jpe?g)$/));
return (
<Wrapper>
{images.map(image => <Img key={image} src={image} />)}
</Wrapper>
);
}
}
export default ImagesPreloader;

View File

@ -6,6 +6,7 @@ import { ConnectedRouter } from 'react-router-redux';
// general
import ErrorBoundary from 'support/ErrorBoundary';
import ImagesPreloader from 'support/ImagesPreloader';
import { getPattern } from 'support/routes';
// landing views
@ -41,6 +42,7 @@ const App = () => (
<Route exact path={getPattern('landing-import')} component={ImportView} />
<Route>
<ErrorBoundary>
<ImagesPreloader />
<WalletContainer>
<Route exact path={getPattern('wallet-settings')} component={WalletSettings} />
<Route exact path={getPattern('wallet-dashboard')} component={WalletDashboard} />