-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathgatsby-browser.js
More file actions
90 lines (79 loc) · 1.96 KB
/
Copy pathgatsby-browser.js
File metadata and controls
90 lines (79 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import { setConfig } from 'react-hot-loader'
import React from 'react'
import 'typeface-lato'
import { MDXProvider } from '@mdx-js/react'
import * as CustomComponents from './.cache/components'
import CodeBlock from './src/components/pattern-library/CodeBlock/CodeBlock.js'
import {
Box,
Container,
Grid,
Table,
TableBody,
TableCell,
TableHead,
TableRow,
Typography,
Hidden
} from '@material-ui/core'
import {
AppStatusProvider,
DownloadProvider
} from './src/stores'
import ErrorBoundary from './src/components/ErrorBoundary'
import { ThemeProvider } from '@material-ui/core/styles'
import theme from './src/js/mui/theme'
import { QueryParamProvider } from 'use-query-params'
import { WindowAdapter } from './src/js/utils/WindowAdapter'
export const onServiceWorkerUpdateReady = () => {
const answer = window.confirm(
'This application has been updated. ' +
'Reload to display the latest version?'
)
if (answer === true) {
window.location.reload()
}
}
export const onClientEntry = async () => {
if (typeof IntersectionObserver === 'undefined') {
await import('intersection-observer')
}
}
// Remove hot loader warning in browser
setConfig({
showReactDomPatchNotification: false
})
const mdxComponents = {
pre: props => <div {...props} />,
p: props => <div {...props} />,
code: CodeBlock,
a: CustomComponents.Link,
...CustomComponents,
Box,
Container,
Grid,
Table,
TableBody,
TableCell,
TableHead,
TableRow,
Typography,
Hidden
}
export const wrapRootElement = ({ element }) => {
return (
<ErrorBoundary>
<ThemeProvider theme={theme}>
<AppStatusProvider>
<DownloadProvider>
<QueryParamProvider adapter={WindowAdapter}>
<MDXProvider components={ mdxComponents }>
{element}
</MDXProvider>
</QueryParamProvider>
</DownloadProvider>
</AppStatusProvider>
</ThemeProvider>
</ErrorBoundary>
)
}