forked from pancakeswap/pancake-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Providers.tsx
39 lines (36 loc) · 1.3 KB
/
Providers.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
28
29
30
31
32
33
34
35
36
37
38
39
import React from 'react'
import { ModalProvider, light, dark } from '@pancakeswap/uikit'
import { Web3ReactProvider } from '@web3-react/core'
import { HelmetProvider } from 'react-helmet-async'
import { Provider } from 'react-redux'
import { ThemeProvider } from 'styled-components'
import { useThemeManager } from 'state/user/hooks'
import { getLibrary } from 'utils/web3React'
import { LanguageProvider } from 'contexts/Localization'
import { RefreshContextProvider } from 'contexts/RefreshContext'
import { ToastsProvider } from 'contexts/ToastsContext'
import store from 'state'
const ThemeProviderWrapper = (props) => {
const [isDark] = useThemeManager()
return <ThemeProvider theme={isDark ? dark : light} {...props} />
}
const Providers: React.FC = ({ children }) => {
return (
<Web3ReactProvider getLibrary={getLibrary}>
<Provider store={store}>
<ToastsProvider>
<HelmetProvider>
<ThemeProviderWrapper>
<LanguageProvider>
<RefreshContextProvider>
<ModalProvider>{children}</ModalProvider>
</RefreshContextProvider>
</LanguageProvider>
</ThemeProviderWrapper>
</HelmetProvider>
</ToastsProvider>
</Provider>
</Web3ReactProvider>
)
}
export default Providers