Skip to content

Commit 9b52f04

Browse files
committed
Lazy loaded demo UI
1 parent 63addd3 commit 9b52f04

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

demo/src/App.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,25 @@ pre {
7777
font-size: 18px !important;
7878
}
7979

80+
::-webkit-scrollbar{
81+
width: 5px;
82+
}
83+
84+
::-webkit-scrollbar-track-piece{
85+
background-color: #FFF;
86+
}
87+
88+
::-webkit-scrollbar-thumb{
89+
background-color: #CBCBCB;
90+
outline: 2px solid #FFF;
91+
outline-offset: -2px;
92+
border: .1px solid #B7B7B7;
93+
}
94+
95+
::-webkit-scrollbar-thumb:hover{
96+
background-color: #909090;
97+
}
98+
8099
@media (max-width: 800px)
81100
{
82101
pre {

demo/src/App.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
import React from 'react';
1+
import React, { Suspense } from 'react';
22
import './App.scss';
33
import ReactGA from 'react-ga';
44
import { Docs } from './docs/Docs';
5-
import { UI } from './ui-demo/UI';
65

76
ReactGA.initialize("UA-144490437-1");
87
ReactGA.pageview(window.location.pathname + window.location.search);
98

109
const App: React.FC = () => {
1110
if (window.location.hash === "#ui-demo")
1211
{
13-
return <UI />
12+
const UI = React.lazy(() => import('./ui-demo/UI').then(({ UI }) => ({ default: UI })));
13+
return <Suspense fallback={<Loading />}><UI /></Suspense>
1414
}
1515

1616
return <Docs />
1717
}
1818

19+
const Loading = () => (<span />)
20+
1921
export default App;

0 commit comments

Comments
 (0)