From 7786d90902a233cd4f9a9c03605c3359e088eb96 Mon Sep 17 00:00:00 2001 From: Daniel Gonzalez Date: Wed, 21 Oct 2020 23:43:23 -0400 Subject: [PATCH] feat(loading): Added loading screen --- src/components/admin-lte/index.js | 13 +++++++++++- src/components/layout.css | 3 +++ src/html.js | 34 ++++++++++++++++++++++++++----- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/src/components/admin-lte/index.js b/src/components/admin-lte/index.js index 453af65..dc54eb0 100644 --- a/src/components/admin-lte/index.js +++ b/src/components/admin-lte/index.js @@ -147,6 +147,15 @@ class AdminLTEPage extends React.Component { } } + hideSplashLoader () { + try { + const loader = document.getElementById('___loader') + loader.className = 'display-none' + } catch (error) { + console.error(error) + } + } + async componentDidMount () { _this.customMenuItems() // _this.addOnClickEventToScanner() @@ -158,6 +167,8 @@ class AdminLTEPage extends React.Component { _this.dropDownBalance() _this.handleGetBalance() + + _this.hideSplashLoader() }, 250) } @@ -327,7 +338,7 @@ class AdminLTEPage extends React.Component { return '' }) ) - } catch (err) {} + } catch (err) { } } getInvisibleMenuItem () { diff --git a/src/components/layout.css b/src/components/layout.css index 0cbe139..7369924 100644 --- a/src/components/layout.css +++ b/src/components/layout.css @@ -740,4 +740,7 @@ pre tt:after { } .background-none{ background: none!important; +} +.display-none{ + display: none!important; } \ No newline at end of file diff --git a/src/html.js b/src/html.js index f8457cd..a96e570 100644 --- a/src/html.js +++ b/src/html.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types' // import { withPrefix, Link } from 'gatsby' // window && typeof window !== 'undefined' && window.test = 'testing' +import Logo from './images/loader.gif' export default function HTML (props) { return ( @@ -22,11 +23,34 @@ export default function HTML (props) { {props.preBodyComponents} -
+
+
+
+ Loading... +
+
+ {props.postBodyComponents}