mirror of
https://github.com/trezor/trezor-wallet
synced 2025-01-16 02:51:03 +00:00
Added image preloader
This commit is contained in:
parent
a114b47b77
commit
72b5120bbc
25
src/support/ImagesPreloader.js
Normal file
25
src/support/ImagesPreloader.js
Normal 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;
|
@ -6,6 +6,7 @@ import { ConnectedRouter } from 'react-router-redux';
|
|||||||
|
|
||||||
// general
|
// general
|
||||||
import ErrorBoundary from 'support/ErrorBoundary';
|
import ErrorBoundary from 'support/ErrorBoundary';
|
||||||
|
import ImagesPreloader from 'support/ImagesPreloader';
|
||||||
import { getPattern } from 'support/routes';
|
import { getPattern } from 'support/routes';
|
||||||
|
|
||||||
// landing views
|
// landing views
|
||||||
@ -41,6 +42,7 @@ const App = () => (
|
|||||||
<Route exact path={getPattern('landing-import')} component={ImportView} />
|
<Route exact path={getPattern('landing-import')} component={ImportView} />
|
||||||
<Route>
|
<Route>
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
|
<ImagesPreloader />
|
||||||
<WalletContainer>
|
<WalletContainer>
|
||||||
<Route exact path={getPattern('wallet-settings')} component={WalletSettings} />
|
<Route exact path={getPattern('wallet-settings')} component={WalletSettings} />
|
||||||
<Route exact path={getPattern('wallet-dashboard')} component={WalletDashboard} />
|
<Route exact path={getPattern('wallet-dashboard')} component={WalletDashboard} />
|
||||||
|
Loading…
Reference in New Issue
Block a user