made with esnextbin
Last active
March 22, 2016 19:27
-
-
Save mibamur/685f4b780261169ade0c to your computer and use it in GitHub Desktop.
esnextbin sketch
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ESNext Bin Sketch</title> | |
<!-- put additional styles and scripts here --> | |
<link href="https://fonts.googleapis.com/css?family=Glass+Antiqua" rel="stylesheet" type="text/css"> | |
<!-- CSS Reset --> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.css"> | |
<!-- Milligram CSS minified --> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/milligram/1.1.0/milligram.min.css"> | |
<style> | |
html { | |
font-family: 'Roboto', sans-serif; | |
} | |
body { | |
font-size: 13px; | |
line-height: 20px; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="app"></div> | |
</body> | |
</html> |
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
import {random} from 'starwars-names' | |
import React from 'react' | |
import ReactDOM from 'react-dom' | |
const App = React.createClass({ | |
getInitialState() { | |
return {name: '[Click the button]'} | |
}, | |
render() { | |
return ( | |
<div> | |
<h1>Random Star Wars Names</h1> | |
<div className="name">{this.state.name}</div> | |
<hr /> | |
<button onClick={() => this.setState({name: random()})}> | |
New Random Name | |
</button> | |
</div> | |
) | |
} | |
}) | |
ReactDOM.render( | |
<App />, | |
document.getElementById('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
{ | |
"name": "matr-sketch", | |
"version": "0.0.1", | |
"dependencies": { | |
"starwars-names": "1.5.3", | |
"react": "0.14.7", | |
"react-dom": "0.14.7" | |
} | |
} |
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
'use strict'; | |
var _starwarsNames = require('starwars-names'); | |
var _react = require('react'); | |
var _react2 = _interopRequireDefault(_react); | |
var _reactDom = require('react-dom'); | |
var _reactDom2 = _interopRequireDefault(_reactDom); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
var App = _react2.default.createClass({ | |
displayName: 'App', | |
getInitialState: function getInitialState() { | |
return { name: '[Click the button]' }; | |
}, | |
render: function render() { | |
var _this = this; | |
return _react2.default.createElement( | |
'div', | |
null, | |
_react2.default.createElement( | |
'h1', | |
null, | |
'Random Star Wars Names' | |
), | |
_react2.default.createElement( | |
'div', | |
{ className: 'name' }, | |
this.state.name | |
), | |
_react2.default.createElement('hr', null), | |
_react2.default.createElement( | |
'button', | |
{ onClick: function onClick() { | |
return _this.setState({ name: (0, _starwarsNames.random)() }); | |
} }, | |
'New Random Name' | |
) | |
); | |
} | |
}); | |
_reactDom2.default.render(_react2.default.createElement(App, null), document.getElementById('app')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment