-
Notifications
You must be signed in to change notification settings - Fork 73
/
gatsby-browser.js
34 lines (31 loc) · 1.05 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
/**
* Implement Gatsby's Browser APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/browser-apis/
*/
exports.onRouteUpdate = ({ location, prevLocation }) => {
if (typeof docsearch !== 'undefined') {
docsearch({ // eslint-disable-line no-undef
apiKey: '9486baf438a1d7fd0b6c982838d6f9bc',
indexName: 'sparkdesignsystem',
inputSelector: '.docs-header-search input',
debug: 'false',
});
docsearch({ // eslint-disable-line no-undef
apiKey: '9486baf438a1d7fd0b6c982838d6f9bc',
indexName: 'sparkdesignsystem',
inputSelector: '.docs-header-search--wide input',
debug: 'false',
});
}
const mainContent = document.querySelector('#gatsby-focus-wrapper');
if (mainContent) mainContent.setAttribute('data-sprk-main', '');
document.getElementsByTagName('html')[0].classList.add('sprk-u-JavaScript');
if (prevLocation !== null) {
// put focus on the first skip nav on the page
const skipNav = document.querySelector(".docs-c-SkipNav");
if (skipNav) {
skipNav.focus()
}
}
};