5
5
*/
6
6
7
7
import React , { useEffect } from 'react'
8
- import T from 'prop-types'
9
- import { values } from 'ramda'
10
8
11
- import { ANCHOR , METRIC } from '@/constant'
9
+ import { ANCHOR } from '@/constant'
12
10
import AnalysisService from '@/services/Analysis'
13
11
import { useNetwork , useShortcut , usePlatform , useDevice } from '@/hooks'
14
12
import { pluggedIn } from '@/utils'
13
+ import { Nullable , TSEO } from '@/types'
15
14
16
15
import ThemePalette from '@/containers/layout/ThemePalette'
17
16
import Header from '@/containers/unit/Header'
@@ -20,6 +19,7 @@ import ModeLine from '@/containers/unit/ModeLine'
20
19
import Drawer from '@/containers/tool/Drawer'
21
20
import CustomScroller from '@/components/CustomScroller'
22
21
22
+ import { TStore } from './store'
23
23
import SEO from './SEO'
24
24
import { Doraemon , ErrorBox , Footer , ErrorPage } from './dynamic'
25
25
@@ -33,14 +33,26 @@ import {
33
33
childrenWithProps ,
34
34
} from './logic'
35
35
36
- const GlobalLayoutContainer = ( {
36
+ type TProps = {
37
+ globalLayout ?: TStore
38
+ children : React . ReactNode
39
+ seoConfig : TSEO
40
+ errorCode ?: number // 400 | 500 | 404
41
+ errorPath ?: Nullable < string >
42
+ noSidebar ?: boolean
43
+ noFooter ?: boolean
44
+
45
+ metric : string
46
+ }
47
+
48
+ const GlobalLayoutContainer : React . FC < TProps > = ( {
37
49
globalLayout : store ,
38
50
seoConfig,
39
51
errorCode,
40
52
errorPath,
41
53
children,
42
- noSidebar,
43
- noFooter,
54
+ noSidebar = false ,
55
+ noFooter = false ,
44
56
metric,
45
57
} ) => {
46
58
const { online } = useNetwork ( )
@@ -116,24 +128,4 @@ const GlobalLayoutContainer = ({
116
128
)
117
129
}
118
130
119
- GlobalLayoutContainer . propTypes = {
120
- children : T . node ,
121
- globalLayout : T . object . isRequired ,
122
- seoConfig : T . object . isRequired , // TODO:
123
- noSidebar : T . bool ,
124
- noFooter : T . bool ,
125
- metric : T . oneOf ( values ( METRIC ) ) ,
126
- errorCode : T . oneOf ( [ null , 404 , 500 ] ) ,
127
- errorPath : T . oneOfType ( [ T . string , T . instanceOf ( null ) ] ) ,
128
- }
129
-
130
- GlobalLayoutContainer . defaultProps = {
131
- children : < div /> ,
132
- noSidebar : false ,
133
- noFooter : false ,
134
- errorCode : null ,
135
- errorPath : null ,
136
- metric : METRIC . COMMUNITY ,
137
- }
138
-
139
- export default pluggedIn ( GlobalLayoutContainer )
131
+ export default pluggedIn ( GlobalLayoutContainer ) as React . FC < TProps >
0 commit comments