diff options
author | 2018-09-18 15:03:20 +0300 | |
---|---|---|
committer | 2023-01-13 10:37:53 +0300 | |
commit | 5142179acd1600dd09b70cf11db2a55e018a9ff7 (patch) | |
tree | 6620974d00b17780fbeec1f1e38a56e815093c94 /vnext/src | |
parent | 6fbd2409121ffb0b74e89ce5a6b167bb4b39f9eb (diff) |
dynamic import
Diffstat (limited to 'vnext/src')
-rw-r--r-- | vnext/src/index.js | 15 | ||||
-rw-r--r-- | vnext/src/style/main.css | 4 | ||||
-rw-r--r-- | vnext/src/views/index.html | 4 |
3 files changed, 14 insertions, 9 deletions
diff --git a/vnext/src/index.js b/vnext/src/index.js index 24fe9352..74e36d84 100644 --- a/vnext/src/index.js +++ b/vnext/src/index.js @@ -1,11 +1,14 @@ import React from 'react'; import ReactDOM from 'react-dom'; +import Loadable from 'react-loadable'; -import App from './App'; +const Juick = Loadable({ + loader: () => import('./App'), + loading: () => <div>Loading...</div> +}); -let container = document.createElement('div'); -ReactDOM.render(<App />, container); -let body = document.getElementById('content').parentNode; -body.replaceChild(container.getElementsByTagName('header')[0], body.querySelector('#header')); -body.replaceChild(container.querySelector('#content'), body.querySelector('#content')); +const JuickApp = () => ( + <Juick /> +); +ReactDOM.render(<JuickApp />, document.getElementById('body')); diff --git a/vnext/src/style/main.css b/vnext/src/style/main.css index 6d78c7eb..77cc56cb 100644 --- a/vnext/src/style/main.css +++ b/vnext/src/style/main.css @@ -87,7 +87,7 @@ noscript article { background: #006699; color: #fff; } -body > header { +#body > header { position: fixed; top: 0; width: 100%; @@ -138,7 +138,7 @@ body > header { min-width: 310px; width: auto; } - body > header { + #body > header { margin-bottom: 15px; } } diff --git a/vnext/src/views/index.html b/vnext/src/views/index.html index e5862bc1..f9fb7e72 100644 --- a/vnext/src/views/index.html +++ b/vnext/src/views/index.html @@ -42,7 +42,8 @@ </script> </head> -<body id="body"> +<body> + <div id="body"> <div id="header"> <div id="header_wrapper"> <div id="logo"><a href="/">Juick</a></div> @@ -56,6 +57,7 @@ </article> </noscript> </div> + </div> <div id="footer"> <div id="footer-right"> · <a href="/help/contacts" rel="nofollow">Contacts</a> · |