55 */
66
77import React , { useEffect } from 'react'
8- import T from 'prop-types'
9- import { values } from 'ramda'
108
11- import { ANCHOR , METRIC } from '@/constant'
9+ import { ANCHOR } from '@/constant'
1210import AnalysisService from '@/services/Analysis'
1311import { useNetwork , useShortcut , usePlatform , useDevice } from '@/hooks'
1412import { pluggedIn } from '@/utils'
13+ import { Nullable , TSEO } from '@/types'
1514
1615import ThemePalette from '@/containers/layout/ThemePalette'
1716import Header from '@/containers/unit/Header'
@@ -20,6 +19,7 @@ import ModeLine from '@/containers/unit/ModeLine'
2019import Drawer from '@/containers/tool/Drawer'
2120import CustomScroller from '@/components/CustomScroller'
2221
22+ import { TStore } from './store'
2323import SEO from './SEO'
2424import { Doraemon , ErrorBox , Footer , ErrorPage } from './dynamic'
2525
@@ -33,14 +33,26 @@ import {
3333 childrenWithProps ,
3434} from './logic'
3535
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 > = ( {
3749 globalLayout : store ,
3850 seoConfig,
3951 errorCode,
4052 errorPath,
4153 children,
42- noSidebar,
43- noFooter,
54+ noSidebar = false ,
55+ noFooter = false ,
4456 metric,
4557} ) => {
4658 const { online } = useNetwork ( )
@@ -116,24 +128,4 @@ const GlobalLayoutContainer = ({
116128 )
117129}
118130
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