@@ -12,6 +12,7 @@ import {
12
12
import Numbers from './_numbers'
13
13
import WhatIsTrader from './_what-is-trader'
14
14
import DHero from 'components/custom/_dhero-dmt5'
15
+ import { DotLoader } from 'components/elements'
15
16
import BackgroundPatternDMT5 from 'images/svg/dmt5/bg_banner_dmt5.svg'
16
17
import BackgroundPatternDMT5_mobile from 'images/svg/dmt5/bg_banner_dmt5_mobile.svg'
17
18
import Layout from 'components/layout/layout'
@@ -22,6 +23,7 @@ import { size } from 'themes/device'
22
23
import { isBrowser } from 'common/utility'
23
24
import { MetaAttributesType } from 'types/page.types'
24
25
import { useIsRtl } from 'components/hooks/use-isrtl'
26
+ import { useHandleLazyLoad } from 'components/hooks/use-handle-lazy-load'
25
27
26
28
const meta_attributes : MetaAttributesType = {
27
29
og_title : localize ( 'DMT5 | MetaTrader 5 | Deriv' ) ,
@@ -46,7 +48,22 @@ const query = graphql`
46
48
}
47
49
}
48
50
`
49
-
51
+ const target = '#gatsby-focus-wrapper'
52
+ const options = {
53
+ root : null ,
54
+ rootMargin : '0px' ,
55
+ threshold : 0.7 ,
56
+ }
57
+ const lazy_components = (
58
+ < >
59
+ < WhyTrader fallback = { < DotLoader /> } />
60
+ < StartTrader />
61
+ < DownloadApp />
62
+ < MarginCalculator />
63
+ < Flexibility />
64
+ < SwapFreeTrading fallback = { < DotLoader /> } />
65
+ </ >
66
+ )
50
67
const DMT5 = ( ) => {
51
68
const [ is_mobile , setMobile ] = useState ( false )
52
69
const data = useStaticQuery ( query )
@@ -59,6 +76,7 @@ const DMT5 = () => {
59
76
window . addEventListener ( 'resize' , handleResizeWindow )
60
77
} , [ ] )
61
78
79
+ const lazyTemplate = useHandleLazyLoad ( lazy_components , target , options )
62
80
const is_rtl = useIsRtl ( )
63
81
const background = useMemo ( ( ) => {
64
82
if ( is_mobile ) {
@@ -107,15 +125,9 @@ const DMT5 = () => {
107
125
background = { background }
108
126
/>
109
127
</ Mobile >
110
-
111
128
< Numbers />
112
129
< WhatIsTrader />
113
- < WhyTrader />
114
- < StartTrader />
115
- < DownloadApp />
116
- < MarginCalculator />
117
- < Flexibility />
118
- < SwapFreeTrading />
130
+ { lazyTemplate }
119
131
< DBanner
120
132
background_pattern = {
121
133
is_mobile ? BackgroundPatternDMT5_mobile : BackgroundPatternDMT5
0 commit comments