diff --git a/gatsby-browser.js b/gatsby-browser.js new file mode 100644 index 000000000..8eaec5cf7 --- /dev/null +++ b/gatsby-browser.js @@ -0,0 +1,5 @@ +exports.onClientEntry = () => { + window.addEventListener('load', () => { + document.body.className = document.body.className.replace(/\bno-js\b/, '') + }) +} diff --git a/gatsby-ssr.js b/gatsby-ssr.js new file mode 100644 index 000000000..673d93095 --- /dev/null +++ b/gatsby-ssr.js @@ -0,0 +1,5 @@ +exports.onRenderBody = ({ setBodyAttributes }) => { + setBodyAttributes({ + className: 'no-js', + }) +} diff --git a/src/components/common/javascript-presence.js b/src/components/common/javascript-presence.js new file mode 100644 index 000000000..1dc546662 --- /dev/null +++ b/src/components/common/javascript-presence.js @@ -0,0 +1,12 @@ +import React from 'react' +import noJsStyles from './javascript-presence.module.scss' + +const JsEnabled = ({ children }) => ( +