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

To help you get started, we’ve selected a few @material-ui/core 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 ohbarye / goofi / helpers / materialUIContext.ts 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 react-static / react-static / examples / material-ui / static.config.js View on Github external
renderToHtml: (render, Comp, meta) => {
    // Create a sheetsRegistry instance.
    const sheetsRegistry = new SheetsRegistry()

    // Create a MUI theme instance.
    const muiTheme = createMuiTheme(theme)

    const generateClassName = createGenerateClassName()

    const html = render(
      
        
          
        
      
    )

    meta.jssStyles = sheetsRegistry.toString()

    return html
  },
  Document: class CustomHtml extends Component {
github MacKentoch / react-material-ui-next-starter / src / front / hoc / withMainLayout / withMainLayout.js View on Github external
h5: string,
  },
};

type State = {
  appName: string,
  drawerOpened: boolean,
  drawerMenus: Array<menu>,
};
// #endregion

// #region constants
const { menus } = appConfig.drawer;
const { APP_NAME } = appConfig;
// we need it to avoid prod bundle style mess ('case code splitting and lazy loading with jss)
const generateClassName = createGenerateClassName({
  dangerouslyUseGlobalCSS: true,
  productionPrefix: 'stupid-jss',
});
const jss = create(jssPreset());
// #endregion

// #region withMainLayout HOC
function withMainLayout() {
  return BaseComponent =&gt; {
    // #region returned Component
    class WithMainLayout extends Component {
      state = {
        appName: APP_NAME,
        drawerOpened: false,
        drawerMenus: menus,
      };</menu>
github studiometa / react-next-starter / client / lib / getPageMUIContext.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 / src / 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 saltyshiomix / nextron / examples / with-typescript-material-ui / renderer / lib / get-page-context.tsx View on Github external
function createPageContext() {
  return {
    theme,
    sheetsManager: new Map(),
    sheetsRegistry: new SheetsRegistry(),
    generateClassName: createGenerateClassName(),
  };
}
github builderbook / builderbook / lib / context.js View on Github external
function createPageContext() {
  return {
    theme,
    sheetsManager: new Map(),
    sheetsRegistry: new SheetsRegistry(),
    generateClassName: createGenerateClassName(),
  };
}
github kitze / JSUI / src / index.js View on Github external
//import store
const imported = importStore(ElectronStore);
const store = Store.create(imported);

//export store
onSnapshot(store, snapshot =&gt; {
  let nextStore = toJS(snapshot);
  ElectronStore.store = exportStore(nextStore);
});

startRouter(store.router, routes);

//material ui
const styleNode = document.createComment('insertion-point-jss');
document.head.insertBefore(styleNode, document.head.firstChild);
const generateClassName = createGenerateClassName();
const jss = create(jssPreset());
jss.options.insertionPoint = 'insertion-point-jss';

ReactDOM.render(
  
    
      
    
  ,
  document.getElementById('root')
);
github arakat-community / arakat / arakat-frontend / src / app.tsx View on Github external
import { ILocalizationLanguage } from "./localization/languages";
import {IApplicationState} from "./store";
import { getTheme } from "./theme";
import MainView from "./views/main";

export interface IAppState {
  location: Location;
  locale: ILocalizationLanguage;
  theme: ITheme;
}

type AllTypes = IAppState &amp; RouteComponentProps ;

const preset: any = jssPreset().plugins;
const jss: any = create({ plugins: [...preset, rtl()] });
const generateClassName: any = createGenerateClassName();

const app: React.SFC  = (props: AllTypes) =&gt; {
  document.body.setAttribute("dir", props.locale.rtl ? "rtl" : "ltr");
  return (