Skip to content

Commit

Permalink
Updated code snippet on getting started guide's installation page.
Browse files Browse the repository at this point in the history
Modified require() calls in main.jsx of webpack example to use component-level require()'s (instead of requiring all of Material-UI).
  • Loading branch information
Shaurya Arora authored and Shaurya Arora committed Sep 2, 2015
1 parent 55e8040 commit a226196
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
16 changes: 11 additions & 5 deletions docs/src/app/components/pages/get-started/installation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,17 @@ class Installation extends React.Component {

render() {
let usageCode =
'/** MyAwesomeReactComponent.jsx */\n\n' +
'let React = require(\'react\'),\n' +
' mui = require(\'material-ui\'),\n' +
' RaisedButton = mui.RaisedButton;\n\n' +
'let MyAwesomeReactComponent = React.createClass({\n\n' +
'// get constant references to React and Material-UI\n' +
'// components, as we will not be modifying these\n\n' +
'const React = require(\'react\');\n\n' +
'// it is good practice to require only those components of\n' +
'// Material-UI that your app needs, instead of requiring all of\n' +
'// Material-UI. This will make your build process faster and\n' +
'// your build output smaller\n\n' +
'const RaisedButton = require(\'material-ui/lib/raised-button\');\n\n' +
'// see node_modules/material-ui/lib/index.js for a mapping of\n' +
'// Material-UI components to require() calls\n\n' +
'const MyAwesomeReactComponent = React.createClass({\n\n' +
' childContextTypes: {\n' +
' muiTheme: React.PropTypes.object\n' +
' },\n\n' +
Expand Down
9 changes: 4 additions & 5 deletions examples/webpack-example/src/app/components/main.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/** In this file, we create a React component which incorporates components provided by material-ui */

let React = require('react');
let mui = require('material-ui');
let RaisedButton = mui.RaisedButton;
let Dialog = mui.Dialog;
let ThemeManager = new mui.Styles.ThemeManager();
let Colors = mui.Styles.Colors;
let RaisedButton = require('material-ui/lib/raised-button');
let Dialog = require('material-ui/lib/dialog');
let ThemeManager = new (require('material-ui/lib/styles/theme-manager'))();
let Colors = require('material-ui/lib/styles/colors');

let Main = React.createClass({

Expand Down

0 comments on commit a226196

Please sign in to comment.