-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-browser.js
103 lines (99 loc) · 2.57 KB
/
gatsby-browser.js
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
91
92
93
94
95
96
97
98
99
100
101
102
103
import React from 'react'
import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client'
import { PrismicLink } from 'apollo-link-prismic'
import GlobalContextProvider from './src/context/GlobalContextProvider'
import Layout from './src/components/Layout'
import { registerLinkResolver } from '@prismicio/gatsby-source-prismic-graphql'
import linkResolver from './src/utils/linkResolver'
import { library } from '@fortawesome/fontawesome-svg-core'
import {
faApple,
faBandcamp,
faFacebookSquare,
faInstagram,
faMixcloud,
faSoundcloud,
faSpotify,
faTwitter,
faYoutube,
} from '@fortawesome/free-brands-svg-icons'
import {
faBook,
faBroadcastTower,
faCalendarAlt,
faCheck,
faComments,
faExclamationTriangle,
faExternalLinkAlt,
faGlobe,
faHeadphones,
faInfoCircle,
faLock,
faMapMarkerAlt,
faPlay,
faPause,
faSearch,
faTag,
faTimes,
} from '@fortawesome/free-solid-svg-icons'
import 'firebase/database'
/**
* @see {@link https://github.com/FortAwesome/react-fontawesome#build-a-library-to-reference-icons-throughout-your-app-more-conveniently Build a Library to Reference Icons Throughout Your App More Conveniently}
*/
library.add(
faApple,
faBandcamp,
faBook,
faBroadcastTower,
faCalendarAlt,
faCheck,
faComments,
faExclamationTriangle,
faExternalLinkAlt,
faHeadphones,
faFacebookSquare,
faGlobe,
faInfoCircle,
faInstagram,
faLock,
faMapMarkerAlt,
faMixcloud,
faPlay,
faPause,
faSoundcloud,
faSearch,
faTag,
faTimes,
faSpotify,
faTwitter,
faYoutube
)
/**
* Create the Apollo Client and give it our Prismic CMS graphql endpoint
* @name ApolloPrismicClient
* @see {@link https://www.apollographql.com/docs/react/get-started/#create-a-client Create a Client}
* @see {@link https://github.com/gatsbyjs/gatsby/issues/11225#issuecomment-457211628 Wrapping root element in gatsby-browser AND gatsby-ssr}
*/
const client = new ApolloClient({
link: PrismicLink({
uri: 'https://hmbk-cms.prismic.io/graphql',
}),
cache: new InMemoryCache(),
})
/**
* @see {@link https://github.com/gatsbyjs/gatsby/issues/11225#issuecomment-457211628 Wrapping root element in gatsby-browser AND gatsby-ssr}
*/
export const wrapRootElement = ({ element }) => {
return (
<GlobalContextProvider>
<ApolloProvider client={client}>{element}</ApolloProvider>
</GlobalContextProvider>
)
}
/**
* Wrap every page created by gatsby with the {@link Layout} component.
*/
export const wrapPageElement = ({ element, props }) => {
return <Layout {...props}>{element}</Layout>
}
registerLinkResolver(linkResolver)