oresome-md-ui

1.0.1 • Public • Published

oresome-md-ui

Extended Material UI components

NPM JavaScript Style Guide

Install

npm install --save oresome-md-ui

Usage

Refer to the example (https://github.com/Leong21/oresome-md-ui/tree/master/example)

import React, { Component } from 'react'
import { MuiThemeProvider, CssBaseline, createMuiTheme } from '@material-ui/core';
import Routes, { navigationRoutes } from './Routes';
import {Provider as AppProvider, defaultContext} from './AppProvider';

import { MainLayout, MenuItems, TopBarActions, Colours } from 'oresome-md-ui';

const Logo = props => (
  <div>Logo</div>
);

export default class App extends Component {
  constructor(props) {
    super(props);

    this.state = {
      ...defaultContext
    }
  }

  handleConfigChange = (name, value) => {
    this.setState({
      [name]: value
    });
  }

  render() {
    const theme = createMuiTheme({
      palette: {...Colours[this.state.colour], type: this.state.type},
      
    })

    return (
      <AppProvider
        value={{
          ...this.state,
          handleConfigChange: this.handleConfigChange
        }}>
        <MuiThemeProvider theme={theme}>
          <CssBaseline />
          <MainLayout
            menuItems={<MenuItems navigationRoutes={navigationRoutes} />}
            topBarActions={TopBarActions}
            logo={Logo}
            updateTheme={this.handleConfigChange}
            colour={this.state.colour}
          >
            <Routes />
          </MainLayout>
        </MuiThemeProvider>
      </AppProvider>
    )
  }
}

License

MIT © Leong21

Readme

Keywords

none

Package Sidebar

Install

npm i oresome-md-ui

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

124 kB

Total Files

8

Last publish

Collaborators

  • leon21