How to use the @material-ui/styles.createGenerateClassName function in @material-ui/styles

To help you get started, we’ve selected a few @material-ui/styles examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github blainegarrett / material-node-next-gae-demo / src / theming / getPageContext.js View on Github external
function createPageContext() {
  return {
    theme,
    // This is needed in order to deduplicate the injection of CSS in the page.
    sheetsManager: new Map(),
    // This is needed in order to inject the critical CSS.
    sheetsRegistry: new SheetsRegistry(),
    // The standard class name generator.
    generateClassName: createGenerateClassName()
  };
}
github mui-org / material-ui / docs / src / modules / styles / getPageContext.js View on Github external
function createPageContext() {
  return {
    jss,
    theme,
    // This is needed in order to deduplicate the injection of CSS in the page.
    sheetsManager: new Map(),
    // This is needed in order to inject the critical CSS.
    sheetsRegistry: new SheetsRegistry(),
    generateClassName: createGenerateClassName({
      productionPrefix: 'j', // Reduce the bandwidth usage.
    }),
  };
}
github mui-org / material-ui-pickers / docs / utils / getPageContext.ts View on Github external
export default function(): PageContext {
  return {
    // This is needed in order to deduplicate the injection of CSS in the page.
    sheetsManager: new Map(),
    // This is needed in order to inject the critical CSS.
    sheetsRegistry: new SheetsRegistry(),
    // The standard class name generator.
    generateClassName: createGenerateClassName(),
  };
}
github bluepeter / gatsby-material-ui-business-starter / src / utils / getPageContext.js View on Github external
function createPageContext() {
  return {
    theme,
    // This is needed in order to deduplicate the injection of CSS in the page.
    sheetsManager: new Map(),
    // This is needed in order to inject the critical CSS.
    sheetsRegistry: new SheetsRegistry(),
    // The standard class name generator.
    generateClassName: createGenerateClassName(),
  };
}
github mui-org / material-ui / examples / nextjs-next-with-typescript / src / getPageContext.ts View on Github external
export default function(): PageContext {
  return {
    theme,
    // This is needed in order to deduplicate the injection of CSS in the page.
    sheetsManager: new Map(),
    // This is needed in order to inject the critical CSS.
    sheetsRegistry: new SheetsRegistry(),
    // The standard class name generator.
    generateClassName: createGenerateClassName(),
    children: undefined,
  };
}
github mui-org / material-ui / packages / material-ui-benchmark / src / server.js View on Github external
function renderStyledFunction(req, res) {
  const sheetsRegistry = new SheetsRegistry();
  const html = ReactDOMServer.renderToString(
    
      {Array.from(new Array(1000)).map((_, index) => (
        
      ))}
    ,
  );
  const css = sheetsRegistry.toString();
  res.send(renderFullPage(html, css));
}
github react-page / react-page / packages / ui / src / ThemeProvider / index.tsx View on Github external
* @author Aeneas Rekkas 
 *
 */
import * as React from 'react';

import { createMuiTheme, Theme } from '@material-ui/core/styles';
import {
  ThemeProvider as MaterialUiThemeProvider,
  StylesProvider
} from '@material-ui/styles';
import { createGenerateClassName } from '@material-ui/styles';
import darkTheme from './DarkTheme/index';
import { themeOptions } from './themeOptions';
export { darkTheme };

const generateClassName = createGenerateClassName({
  disableGlobal: true,
  productionPrefix: 'ory',
});
const theme = createMuiTheme(themeOptions);

export interface ThemeProviderProps {
  theme?: Theme;
}

class ThemeProvider extends React.Component {
  render() {
    return (
      
        
          {this.props.children}
github mui-org / material-ui / packages / material-ui-benchmark / src / server.js View on Github external
function renderAvatar(req, res) {
  const sheetsRegistry = new SheetsRegistry();
  const html = ReactDOMServer.renderToString(
    
      {Array.from(new Array(1)).map((_, index) => (
        Avatar
      ))}
    ,
  );
  const css = sheetsRegistry.toString();
  res.send(renderFullPage(html, css));
}
github mui-org / material-ui / packages / material-ui-benchmark / src / server.js View on Github external
function renderBox(req, res) {
  const sheetsRegistry = new SheetsRegistry();
  const html = ReactDOMServer.renderToString(
    
      
        {Array.from(new Array(1000)).map((_, index) => (
          
        ))}
      
    ,
  );
  const css = sheetsRegistry.toString();
  res.send(renderFullPage(html, css));
}