Skip to content

Instantly share code, notes, and snippets.

Created November 28, 2015 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/ed687966c9bc55723cb8 to your computer and use it in GitHub Desktop.
Save anonymous/ed687966c9bc55723cb8 to your computer and use it in GitHub Desktop.
Reaction // source https://jsbin.com/jotanay
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="http://fb.me/react-with-addons-0.13.3.js"></script>
<meta charset="utf-8">
<title>Reaction</title>
<style id="jsbin-css">
@keyframes spin {
100% {
transform:rotate(360deg);
}
}
</style>
</head>
<body>
<div id="mount-point"></div>
<script id="jsbin-javascript">
"use strict";
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Wheel = (function (_React$Component) {
_inherits(Wheel, _React$Component);
function Wheel(props) {
_classCallCheck(this, Wheel);
_get(Object.getPrototypeOf(Wheel.prototype), "constructor", this).call(this, props);
this.props.image = "https://s3.amazonaws.com/code_brian/react/Front+Wheel.png";
}
_createClass(Wheel, [{
key: "render",
value: function render() {
var styles = {
wheel: {
position: "absolute",
top: this.props.top + "px",
right: this.props.right + "px",
width: "120px",
height: "120px",
margin: "-60px 0 0 -60px",
animation: "spin 4s linear infinite"
}
};
return React.createElement("img", {
style: styles.wheel,
src: this.props.image });
}
}]);
return Wheel;
})(React.Component);
var BackWheel = (function (_Wheel) {
_inherits(BackWheel, _Wheel);
function BackWheel(props) {
_classCallCheck(this, BackWheel);
_get(Object.getPrototypeOf(BackWheel.prototype), "constructor", this).call(this, props);
this.props.image = "https://s3.amazonaws.com/code_brian/react/Back+Wheel.png";
}
return BackWheel;
})(Wheel);
var Chassis = (function (_React$Component2) {
_inherits(Chassis, _React$Component2);
function Chassis() {
_classCallCheck(this, Chassis);
_get(Object.getPrototypeOf(Chassis.prototype), "constructor", this).apply(this, arguments);
}
_createClass(Chassis, [{
key: "render",
value: function render() {
var styles = {
chassis: {
position: "absolute",
top: "50px",
right: "130px",
width: "200px"
}
};
return React.createElement("img", { style: styles.chassis, src: "https://s3.amazonaws.com/code_brian/react/Chassis.png" });
}
}]);
return Chassis;
})(React.Component);
var Motor = (function (_React$Component3) {
_inherits(Motor, _React$Component3);
function Motor() {
_classCallCheck(this, Motor);
_get(Object.getPrototypeOf(Motor.prototype), "constructor", this).apply(this, arguments);
}
_createClass(Motor, [{
key: "render",
value: function render() {
var styles = {
motor: {
position: "absolute",
top: "53px",
right: "150px",
width: "100px"
}
};
return React.createElement("img", { style: styles.motor, src: "https://s3.amazonaws.com/code_brian/react/Motor.png" });
}
}]);
return Motor;
})(React.Component);
var Exhaust = (function (_React$Component4) {
_inherits(Exhaust, _React$Component4);
function Exhaust() {
_classCallCheck(this, Exhaust);
_get(Object.getPrototypeOf(Exhaust.prototype), "constructor", this).apply(this, arguments);
}
_createClass(Exhaust, [{
key: "render",
value: function render() {
var styles = {
exhaust: {
position: "absolute",
top: this.props.top + "px",
right: this.props.right + "px",
width: "150px"
}
};
return React.createElement("img", { style: styles.exhaust, src: "https://s3.amazonaws.com/code_brian/react/Exhaust.png" });
}
}]);
return Exhaust;
})(React.Component);
var Moto = (function (_React$Component5) {
_inherits(Moto, _React$Component5);
function Moto() {
_classCallCheck(this, Moto);
_get(Object.getPrototypeOf(Moto.prototype), "constructor", this).apply(this, arguments);
}
_createClass(Moto, [{
key: "render",
value: function render() {
var styles = {
moto: {
top: this.props.top + "px",
right: this.props.right + "px",
position: "relative"
}
};
return React.createElement(
"div",
{ style: styles.moto },
React.createElement(BackWheel, { top: "150", right: "270" }),
React.createElement(Wheel, { top: "150", right: "50" }),
React.createElement(Motor, null),
React.createElement(Chassis, null),
React.createElement(Exhaust, { top: "90", right: "150" })
);
}
}]);
return Moto;
})(React.Component);
React.render(React.createElement(
"div",
null,
React.createElement(Moto, { top: "100", right: "100" })
), document.getElementById('mount-point'));
</script>
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery.min.js"><\/script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"><\/script>
<script src="//fb.me/react-with-addons-0.13.3.js"><\/script>
<meta charset="utf-8">
<title>Reaction</title>
</head>
<body>
<div id="mount-point"></div>
</body>
</html></script>
<script id="jsbin-source-css" type="text/css">@keyframes spin {
100% {
transform:rotate(360deg);
}
}
</script>
<script id="jsbin-source-javascript" type="text/javascript">
class Wheel extends React.Component {
constructor (props) {
super(props);
this.props.image = "https://s3.amazonaws.com/code_brian/react/Front+Wheel.png";
}
render() {
var styles = {
wheel: {
position: "absolute",
top: this.props.top + "px",
right: this.props.right + "px",
width: "120px",
height: "120px",
margin: "-60px 0 0 -60px",
animation: "spin 4s linear infinite"
}
};
return (
<img
style={styles.wheel}
src={this.props.image}>
</img>
);
}
}
class BackWheel extends Wheel {
constructor (props) {
super(props);
this.props.image = "https://s3.amazonaws.com/code_brian/react/Back+Wheel.png";
}
}
class Chassis extends React.Component {
render() {
var styles = {
chassis: {
position: "absolute",
top: "50px",
right: "130px",
width: "200px"
}
}
return (
<img style={styles.chassis} src="https://s3.amazonaws.com/code_brian/react/Chassis.png">
</img>
)
}
}
class Motor extends React.Component {
render() {
var styles = {
motor: {
position: "absolute",
top: "53px",
right: "150px",
width: "100px"
}
}
return (
<img style={styles.motor} src="https://s3.amazonaws.com/code_brian/react/Motor.png"></img>
)
}
}
class Exhaust extends React.Component {
render() {
var styles = {
exhaust: {
position: "absolute",
top: this.props.top + "px",
right: this.props.right + "px",
width: "150px"
}
}
return (
<img style={styles.exhaust} src="https://s3.amazonaws.com/code_brian/react/Exhaust.png"></img>
);
}
}
class Moto extends React.Component {
render() {
var styles = {
moto: {
top: this.props.top + "px",
right: this.props.right + "px",
position: "relative"
}
}
return (
<div style={styles.moto}>
<BackWheel top="150" right="270"></BackWheel>
<Wheel top="150" right="50"></Wheel>
<Motor></Motor>
<Chassis></Chassis>
<Exhaust top="90" right="150"></Exhaust>
</div>
)
}
}
React.render(
<div>
<Moto top="100" right="100"></Moto>
</div>,
document.getElementById('mount-point')
);</script></body>
</html>
@keyframes spin {
100% {
transform:rotate(360deg);
}
}
"use strict";
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Wheel = (function (_React$Component) {
_inherits(Wheel, _React$Component);
function Wheel(props) {
_classCallCheck(this, Wheel);
_get(Object.getPrototypeOf(Wheel.prototype), "constructor", this).call(this, props);
this.props.image = "https://s3.amazonaws.com/code_brian/react/Front+Wheel.png";
}
_createClass(Wheel, [{
key: "render",
value: function render() {
var styles = {
wheel: {
position: "absolute",
top: this.props.top + "px",
right: this.props.right + "px",
width: "120px",
height: "120px",
margin: "-60px 0 0 -60px",
animation: "spin 4s linear infinite"
}
};
return React.createElement("img", {
style: styles.wheel,
src: this.props.image });
}
}]);
return Wheel;
})(React.Component);
var BackWheel = (function (_Wheel) {
_inherits(BackWheel, _Wheel);
function BackWheel(props) {
_classCallCheck(this, BackWheel);
_get(Object.getPrototypeOf(BackWheel.prototype), "constructor", this).call(this, props);
this.props.image = "https://s3.amazonaws.com/code_brian/react/Back+Wheel.png";
}
return BackWheel;
})(Wheel);
var Chassis = (function (_React$Component2) {
_inherits(Chassis, _React$Component2);
function Chassis() {
_classCallCheck(this, Chassis);
_get(Object.getPrototypeOf(Chassis.prototype), "constructor", this).apply(this, arguments);
}
_createClass(Chassis, [{
key: "render",
value: function render() {
var styles = {
chassis: {
position: "absolute",
top: "50px",
right: "130px",
width: "200px"
}
};
return React.createElement("img", { style: styles.chassis, src: "https://s3.amazonaws.com/code_brian/react/Chassis.png" });
}
}]);
return Chassis;
})(React.Component);
var Motor = (function (_React$Component3) {
_inherits(Motor, _React$Component3);
function Motor() {
_classCallCheck(this, Motor);
_get(Object.getPrototypeOf(Motor.prototype), "constructor", this).apply(this, arguments);
}
_createClass(Motor, [{
key: "render",
value: function render() {
var styles = {
motor: {
position: "absolute",
top: "53px",
right: "150px",
width: "100px"
}
};
return React.createElement("img", { style: styles.motor, src: "https://s3.amazonaws.com/code_brian/react/Motor.png" });
}
}]);
return Motor;
})(React.Component);
var Exhaust = (function (_React$Component4) {
_inherits(Exhaust, _React$Component4);
function Exhaust() {
_classCallCheck(this, Exhaust);
_get(Object.getPrototypeOf(Exhaust.prototype), "constructor", this).apply(this, arguments);
}
_createClass(Exhaust, [{
key: "render",
value: function render() {
var styles = {
exhaust: {
position: "absolute",
top: this.props.top + "px",
right: this.props.right + "px",
width: "150px"
}
};
return React.createElement("img", { style: styles.exhaust, src: "https://s3.amazonaws.com/code_brian/react/Exhaust.png" });
}
}]);
return Exhaust;
})(React.Component);
var Moto = (function (_React$Component5) {
_inherits(Moto, _React$Component5);
function Moto() {
_classCallCheck(this, Moto);
_get(Object.getPrototypeOf(Moto.prototype), "constructor", this).apply(this, arguments);
}
_createClass(Moto, [{
key: "render",
value: function render() {
var styles = {
moto: {
top: this.props.top + "px",
right: this.props.right + "px",
position: "relative"
}
};
return React.createElement(
"div",
{ style: styles.moto },
React.createElement(BackWheel, { top: "150", right: "270" }),
React.createElement(Wheel, { top: "150", right: "50" }),
React.createElement(Motor, null),
React.createElement(Chassis, null),
React.createElement(Exhaust, { top: "90", right: "150" })
);
}
}]);
return Moto;
})(React.Component);
React.render(React.createElement(
"div",
null,
React.createElement(Moto, { top: "100", right: "100" })
), document.getElementById('mount-point'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment