styled-components#ThemeProvider JavaScript Examples

The following examples show how to use styled-components#ThemeProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: App.jsx    From cosmoscan-front with Apache License 2.0 7 votes vote down vote up
App = () => (
  <Router>
    <HelmetProvider>
      <ThemeProvider theme={theme}>
        <Normalize />
        <GlobalStyles />
        <StateProvider>
          <LayoutDefault>
            <Routes />
          </LayoutDefault>
        </StateProvider>
      </ThemeProvider>
    </HelmetProvider>
  </Router>
)
Example #2
Source File: themeManager.js    From about-1hive with GNU General Public License v3.0 6 votes vote down vote up
StyledThemeProvider = props => {
  const [isDarkMode] = useDarkMode()

  return (
    <ThemeProvider theme={theme(isDarkMode)}>
      <GlobalStyle isDark={isDarkMode} />
      {props.children}
    </ThemeProvider>
  )
}
Example #3
Source File: index.js    From foster-together-fe with MIT License 6 votes vote down vote up
renderWithReduxAndRouter = ui => {
  return {
    ...render(
      <Provider store={store}>
        <ThemeProvider theme={theme}>
          <BrowserRouter>{ui}</BrowserRouter>
        </ThemeProvider>
      </Provider>
    ),
    store,
  }
}
Example #4
Source File: index.js    From covidzero-frontend with Apache License 2.0 6 votes vote down vote up
ReactDOM.render(
  <Provider store={store}>
    <Router history={history}>
      <GlobalFonts />
      <ThemeProvider theme={theme}>
        <Suspense fallback={<div>Carregando...</div>}>
          <App />
        </Suspense>
      </ThemeProvider>
    </Router>
  </Provider>,
  document.getElementById("root")
);
Example #5
Source File: index.js    From airdnd-frontend with MIT License 6 votes vote down vote up
ReactDOM.render(
  <Provider store={store}>
    <BrowserRouter>
      <ThemeProvider theme={theme}>
        <App />
      </ThemeProvider>
    </BrowserRouter>
  </Provider>,
  document.getElementById('root'),
);
Example #6
Source File: polling-locator.js    From pollaris with MIT License 6 votes vote down vote up
function PollingLocator({
  data: {
    contentfulPage,
    allContentfulPagePollingPlaceLocator: { nodes },
  },
}) {
  return (
    <div>
      <Helmet title={contentfulPage.metaTitle} />
      <GlobalSiteStyles />
      <ThemeProvider theme={theme}>
        <Nav pageNodes={nodes} locale={contentfulPage.node_locale} />
        <PagePollingLocator settings={contentfulPage.contentType} />
      </ThemeProvider>
    </div>
  )
}
Example #7
Source File: _app.js    From website with MIT License 6 votes vote down vote up
render() {
    const { Component, pageProps } = this.props;
    return (
      <Provider store={store}>
        <RemoteConfigProvider>
          <ThemeProvider theme={{ orbit: tokens }}>
            <>
              <GlobalStyle />
              <Component {...pageProps} />
            </>
          </ThemeProvider>
        </RemoteConfigProvider>
      </Provider>
    );
  }
Example #8
Source File: App.js    From dexwebapp with Apache License 2.0 6 votes vote down vote up
render() {
    return (
      <TrackerProvider tracker={tracker}>
        <UserPreferenceContext.Provider value={this.props.userPreferences}>
          <ThemeProvider theme={this.props.userPreferences.theme}>
            <BrowserGlobalStyles />
            <AntdGlobalStyles />
            <AntdTableStyles />
            <AntdFormStyles />
            <AntdModalStyles />
            <AppClassStyles />
            <WalletConnectStyles />
            <Suspense fallback={null}>
              <ConnectedRouter history={history}>{routes}</ConnectedRouter>
            </Suspense>
          </ThemeProvider>
        </UserPreferenceContext.Provider>
      </TrackerProvider>
    );
  }
Example #9
Source File: App.js    From eKYC with GNU General Public License v3.0 6 votes vote down vote up
function App() {
  return (
    <ThemeProvider theme={customTheme}>
      <BrowserRouter>
        <Switch>
          <Route path='/' exact component={Login} />
          <Route path='/index' exact component={Login} />
          <Route path='/login' exact component={Login} />
          <Route path='/client' exact component={Client} />
          <Route path='/fi' exact component={Fi} />
          <Route path='/fi/newClient' exact component={NewClient} />
        </Switch>
      </BrowserRouter>
    </ThemeProvider>
  );
}
Example #10
Source File: index.js    From gnosis-safe-delegate-dapp with MIT License 6 votes vote down vote up
ReactDOM.render(
  <React.StrictMode>
      <GlobalStyles />
      <ThemeProvider theme={theme}>
          <Web3ReactProvider getLibrary={getLibrary}>
            <App />
          </Web3ReactProvider>
      </ThemeProvider>
  </React.StrictMode>,
  document.getElementById('root')
);
Example #11
Source File: blog-grid.js    From layer5-ng with Apache License 2.0 6 votes vote down vote up
BlogGridPage = () => (
  <ThemeProvider theme={theme}>
    <Layout>
      <GlobalStyle />
      <SEO title="Blog | Layer5 - The Service Mesh Company" />
      <Navigation />
      <BlogPage />
      <Footer/>
    </Layout>
  </ThemeProvider>
)
Example #12
Source File: App.js    From portfolio with MIT License 6 votes vote down vote up
function App() {
  console.log("starting");
  const [theme, toggleTheme, componentMounted] = useDarkMode();

  const themeMode = theme === 'light' ? blueTheme : darkTheme;
  console.log(themeMode);


  if (!componentMounted) {
    return <div />
  };


  return (
    <ThemeProvider theme={themeMode}>
      <>
        <GlobalStyles />
        <div>
          <Main theme={themeMode} />
        </div>
        <Toggle theme={theme} toggleTheme={toggleTheme} />
        <Footer theme={themeMode} />
      </>
    </ThemeProvider>
  );
}
Example #13
Source File: icon.stories.js    From VTour with MIT License 6 votes vote down vote up
storiesOf('Icon', module).add('Default', function () {
  var Icon = Icons[text('Icon', 'Accessibility')];

  if (!Icon) {
    return null;
  }

  return React.createElement(Icon, null);
}).add('Color', function () {
  var Icon = Icons[text('Icon', 'Accessibility')];

  if (!Icon) {
    return null;
  }

  return React.createElement(ThemeProvider, {
    theme: customTheme
  }, React.createElement(Icon, {
    size: text('Size', 'xlarge'),
    color: text('Color', 'attention')
  }));
}).add('Plain', function () {
  return React.createElement(Icons.Facebook, {
    color: "plain"
  });
}).add('Custom Theme', function () {
  var Icon = Icons[text('Icon', 'Accessibility')];

  if (!Icon) {
    return null;
  }

  return React.createElement(ThemeProvider, {
    theme: customTheme
  }, React.createElement(Icon, {
    size: text('Size', 'xlarge')
  }));
});
Example #14
Source File: Layout.js    From adarshaacharya.com.np with MIT License 6 votes vote down vote up
Layout = ({ children }) => {
  const { theme, toggleTheme } = useDarkMode();
  const currentTheme = theme === 'light' ? lightTheme : darkTheme;

  return (
    <ThemeProvider theme={currentTheme}>
      <>
        <GlobalStyles />
        <ThemeToggleContext.Provider value={{ theme, toggleTheme }}>
          <Navbar />
        </ThemeToggleContext.Provider>
        <LayoutWrapper>{children}</LayoutWrapper>
        <Footer />
      </>
    </ThemeProvider>
  );
}
Example #15
Source File: app.js    From turkce-sozluk with MIT License 6 votes vote down vote up
function App() {
  return (
    <ThemeProvider theme={theme}>
      <SafeAreaProvider>
        <Navigation />
      </SafeAreaProvider>
    </ThemeProvider>
  )
}
Example #16
Source File: index.js    From redux-todo-web with MIT License 6 votes vote down vote up
function App() {
    const [theme, setTheme, componentMounted] = useDarkMode();

    if (!componentMounted) {
        return <div />;
    }

    return (
        <ThemeProvider theme={theme === "light" ? lightTheme : darkTheme}>
            <TodoContainer>
                <TodoTitleText>TO DO LIST</TodoTitleText>
                <SocialMedia />
                <UserInfo />
                <TodoInput />
                <Header />
                <TodoList />
                <ThemeChangeButton theme={theme} setTheme={setTheme} />
                <GlobalStyles />
            </TodoContainer>
            <LoadingOverlay />
            <SnackBar />
            <LoginDialog />
            <SignUpDialog />
        </ThemeProvider>
    );
}
Example #17
Source File: _app.js    From lightning-address with MIT License 6 votes vote down vote up
export default function App({ Component, pageProps }) {
  return (
    <>
      <GlobalStyle />
      <ThemeProvider theme={theme}>
        <Component {...pageProps} />
      </ThemeProvider>
    </>
  )
}
Example #18
Source File: App.js    From masterPortfolio with MIT License 6 votes vote down vote up
function App() {
  return (
    <ThemeProvider theme={chosenTheme}>
      <>
        <GlobalStyles />
        <div>
          <Main theme={chosenTheme} />
        </div>
      </>
    </ThemeProvider>
  );
}
Example #19
Source File: layout.js    From demolab with MIT License 6 votes vote down vote up
export default function Layout({ children }) {
  const data = useStaticQuery(
      graphql`
        query {
          site {
            siteMetadata {
              title
            }
          }
        }
      `
  );

  const localTheme = typeof window !== 'undefined' && window.localStorage.getItem('theme');
  const themeMode = (!localTheme || localTheme === 'light') ? lightTheme : darkTheme;

  return (
    <ThemeProvider theme={ themeMode }>
      <>
        <GlobalStyles/>
        <Container>
          <Header title={data.site.siteMetadata.title}/>
          {children}
        </Container>
      </>
    </ThemeProvider>
  )
}
Example #20
Source File: gatsby-browser.js    From derivcrypto-com with Apache License 2.0 6 votes vote down vote up
wrapRootElement = ({ element }) => {
    return (
        <StateProvider>
            <ThemeProvider theme={theme}>
                <MediaContextProvider>
                    <SnackbarProvider>{element}</SnackbarProvider>
                </MediaContextProvider>
            </ThemeProvider>
        </StateProvider>
    )
}
Example #21
Source File: App.js    From Agaave-frontend with MIT License 6 votes vote down vote up
render() {
    return (
      <ThemeProvider theme={theme}>
        <Router>
          <Layout>
            <Switch>
              <Route path="/markets" component={Markets} exact />
              <Route path="/reserve-overview/:id" component={ReserveOverview} exact />
              <Route path="/dashboard" component={Dashboard} exact />
              <Route path="/deposit" component={Deposit} exact />
              <Route path="/borrow" component={Borrow} exact />
              <Redirect from="/" to="/markets" />
            </Switch>
            <NotificationContainer />
          </Layout>
        </Router>
      </ThemeProvider>
    );
  }
Example #22
Source File: App.js    From codeclannigeria-frontend with MIT License 6 votes vote down vote up
function App() {
  return (
    <div>
      <ThemeProvider theme={globalStyles}>
        <BaseRouter />
      </ThemeProvider>
    </div>
  );
}
Example #23
Source File: terminal-app.js    From ThreatMapper with Apache License 2.0 6 votes vote down vote up
render() {
    const style = {borderTop: `4px solid ${this.state.titleBarColor}`};

    return (
      <ThemeProvider theme={{...commonTheme, scope: defaultTheme }}>
        <>
          <GlobalStyle />
          <div className="terminal-app" style={style}>
            {this.props.controlPipe && (
              <Terminal
                pipe={this.props.controlPipe}
                titleBarColor={this.state.titleBarColor}
                statusBarColor={this.state.statusBarColor}
                title={this.state.title}
                embedded={false} />
            )}
          </div>
        </>
      </ThemeProvider>
    );
  }
Example #24
Source File: theme.js    From elementor-editor-packages with GNU General Public License v3.0 6 votes vote down vote up
export default function Theme( props ) {
	const isDarkMode = false; // elementorAppConfig...

	let theme = props.default;

	if ( isDarkMode && props.dark ) {
		theme = {
			...props.default,
			...props.dark,
		};
	}

	return (
		<ThemeProvider theme={ theme }>
			{ props.children }
		</ThemeProvider>
	);
}
Example #25
Source File: Layout.js    From gatsby-contentful-blog-portfolio with MIT License 6 votes vote down vote up
Layout = ({ children }) => {
  return (
    <main>
      <ThemeProvider theme={Theme}>
        <GlobalStyle />
        <Navbar />
        {children}
        <Footer />
      </ThemeProvider>
      <Script
        innerHTMLCode={`
            document.querySelector('.logo-btn').addEventListener('click', function (){
              document.querySelector('.nav-links').classList.toggle("show-nav");
            })
          `}
      />
    </main>
  )
}
Example #26
Source File: ThemeProvider.jsx    From resilience-app with GNU General Public License v3.0 6 votes vote down vote up
export default function ({ children, theme }) {
  const customTheme = createMuiTheme(theme);
  return (
    <>
      <MuiThemeProvider theme={customTheme}>
        <ThemeProvider theme={customTheme}>{children}</ThemeProvider>
      </MuiThemeProvider>
    </>
  );
}
Example #27
Source File: App.js    From indeplot with GNU General Public License v3.0 6 votes vote down vote up
App = () => {

  const [theme, themeToggler, mountedComponent] = useDarkMode();
  const themeMode = theme === 'light' ? lightTheme : darkTheme;

  if(!mountedComponent) return <div/>
  return (
   < ThemeProvider theme={themeMode} >
     <>
     <GlobalStyles />
      <Router>
        <Route 
          path='/' 
          exact
          render={(props) => <HomePage {...props} theme={theme.toString()} themeToggler={themeToggler} />} 
        />
      </Router>
      </>
    </ThemeProvider>
  );
}
Example #28
Source File: Application.js    From friendbank-markey with MIT License 6 votes vote down vote up
export default function Application(props) {
  const initialState = { ...props };
  if (!initialState.PageComponent) {
    initialState.PageComponent = router(location.pathname).pop();
  }

  const [state, dispatch] = React.useReducer(reducer, initialState);

  const contextValue = {
    ...state,
    dispatch,
  };

  const { PageComponent } = state;

  return (
    <React.Fragment>
      <ThemeProvider theme={theme}>
        <ApplicationContext.Provider value={contextValue}>
          <GlobalStyle />
          <Chrome>
            <PageContainer>
              <Nav />
              <PageComponent />
              <CommitteeDisclaimer />
            </PageContainer>
          </Chrome>
        </ApplicationContext.Provider>
      </ThemeProvider>
    </React.Fragment>
  );
}
Example #29
Source File: App.js    From gitpedia with MIT License 6 votes vote down vote up
App = () => {
    // Custom hook for persistent darkmode
    const [theme, setTheme] = useDarkMode();

    return (
        <ThemeProvider
            theme={{
                ...theme,
                setTheme: () => {
                    setTheme((state) =>
                        state.id === "light" ? DarkTheme : LightTheme
                    );
                },
            }}>
            <GlobalStyle />
            <Router>
                <Switch>
                    <Route path='/' exact component={Home} />
                    <Route path='/user/:id' component={UserProfile} />
                </Switch>
            </Router>
        </ThemeProvider>
    );
}