npm install -g create-react-app
create-react-app foobar
cd foobar
npm install --save react-tap-event-plugin material-ui material-design-icons
cp -R node_modules/material-design-icons/iconfont public/fonts/
atom .
npm start
Last active
November 22, 2016 16:18
-
-
Save ben-bradley/5f532c4b846329cb4e72ea7a29954594 to your computer and use it in GitHub Desktop.
Create-React-App with MUI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/index.js | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import injectTapEventPlugin from 'react-tap-event-plugin'; | |
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; | |
import App from './App'; | |
import './index.css'; | |
injectTapEventPlugin(); | |
const ThemedApp = () => ( | |
<MuiThemeProvider> | |
<App /> | |
</MuiThemeProvider> | |
); | |
ReactDOM.render( | |
<ThemedApp />, | |
document.getElementById('root') | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/App.js | |
import React, { Component } from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
import Card from './components/Card'; | |
class App extends Component { | |
render() { | |
return ( | |
<div className="App"> | |
<link href="fonts/material-icons.css" rel="stylesheet" /> | |
<div className="App-header"> | |
<img src={logo} className="App-logo" alt="logo" /> | |
<h2>Welcome to React</h2> | |
</div> | |
<div> | |
Hello, World! | |
</div> | |
<Card /> | |
<p className="App-intro"> | |
To get started, edit <code>src/App.js</code> and save to reload. | |
</p> | |
</div> | |
); | |
} | |
} | |
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/components/Card.js | |
import React from 'react'; | |
import { Card, CardActions, CardHeader, CardText } from 'material-ui/Card'; | |
import FlatButton from 'material-ui/FlatButton'; | |
const CardExampleExpandable = () => ( | |
<Card> | |
<CardHeader | |
title="Without Avatar" | |
subtitle="Subtitle" | |
actAsExpander={true} | |
showExpandableButton={true} | |
/> | |
<CardActions> | |
<FlatButton label="Action1" /> | |
<FlatButton label="Action2" /> | |
</CardActions> | |
<CardText expandable={true}> | |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. | |
Donec mattis pretium massa. Aliquam erat volutpat. Nulla facilisi. | |
Donec vulputate interdum sollicitudin. Nunc lacinia auctor quam sed pellentesque. | |
Aliquam dui mauris, mattis quis lacus id, pellentesque lobortis odio. | |
</CardText> | |
</Card> | |
); | |
export default CardExampleExpandable; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment