-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgatsby-browser.js
41 lines (37 loc) · 1002 Bytes
/
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
/**
* Implement Gatsby's Browser APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/browser-apis/
*/
import WebFont from 'webfontloader'
import wrapWithProvider from './wrap-with-provider'
import { anchorate } from 'anchorate'
export const wrapRootElement = wrapWithProvider
export const onInitialClientRender = () => {
WebFont.load({
google: {
families: [
'Work Sans:400:latin,latin-ext',
'Playfair Display:400,700',
'Raleway'
]
},
custom: {
families: ['Ostrich Sans Rounded', 'Playfair Display Bold'],
urls: [
'https://cdn.jsdelivr.net/gh/theleagueof/ostrich-sans/webfonts/ostrich-sans.css',
'http://pl.allfont.net/allfont.css?fonts=playfair-display-bold'
]
}})
}
export const onRouteUpdate = () => anchorate({
scroller: el => {
if (!el) return false
el.scrollIntoView({ behavior: 'smooth' })
window.scrollBy({
top: 70,
behavior: 'smooth'
})
return true
}
})