-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-browser.tsx
27 lines (24 loc) · 899 Bytes
/
gatsby-browser.tsx
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
import "react-toastify/dist/ReactToastify.css";
import { GatsbyBrowser } from "gatsby";
import * as React from "react";
import { toast, ToastContainer } from "react-toastify";
import { ThemeProvider } from "./src/providers/ThemeProvider";
export const onServiceWorkerUpdateReady: GatsbyBrowser["onServiceWorkerUpdateReady"] = () => {
toast.info(
<>
This page has a new update which shall be automatically applied the next time you reload the browser.
<br />
Click here if you want to reload it now?
</>,
{ autoClose: false, position: "bottom-left", onClick: () => window.location.reload() }
);
};
export const wrapRootElement: GatsbyBrowser["wrapRootElement"] = ({ element }) => (
<ThemeProvider>{element}</ThemeProvider>
);
export const wrapPageElement: GatsbyBrowser["wrapPageElement"] = ({ element }) => (
<>
{element}
<ToastContainer />
</>
);