render: function () { var imageComponment, headingComponment, bodyComponment; if (this.props.post.heading || this.props.post.subHeading) { headingComponment = React.createElement(Heading, {heading: this.props.post.heading, subHeading: this.props.post.subHeading} ) } if (this.props.post.image && this.props.post.image.figure) { imageComponment = React.createElement(Image, { image: this.props.post.image} ) } if(this.props.post.body) { bodyComponment = React.createElement(Body, { body: this.props.post.body} ) } return ( React.createElement("article", {className: "blogPost"}, headingComponment, imageComponment, bodyComponment, React.createElement("button", {onClick: this.props.onClick}, "Delete Me") ) ) }
render: function() { return ( React.createElement("div", null, React.createElement("h1", null, this.props.item.heading), React.createElement("h2", null, this.props.item.subHeading) ) ); }
define(function (require) { var React = require('react.min'); return React.createClass({ render: function () { var posts = [], post, i = 0, postsLength = this.props.blogPosts.length; for (; i < postsLength; i += 1) { post = this.props.blogPosts[i]; posts.push(React.createElement(Post, { key: 'k' + post.assetId, item: post} )); } return ( React.createElement("section", null, React.createElement("div", null, post ) ) ); } }); });
render: function () { var headingElement, bodyElement, imageElement, videoElement, video, postId = 'post_' + this.props.item.assetId; if (this.props.heading || this.props.subHeading) { console.log('hello world'); headingElement = React.createElement(Heading, {heading: this.props.heading, subHeading: this.props.subHeading} ) } //if (this.props.body) { // bodyElement = // <Body body={this.props.body} // /> //} // //if (this.props.image && this.props.image.figure && this.props.image.alt) { // imageElement = // <img src={this.props.figure} alt={this.props.alt} width='60%' // /> //} // //if (this.props.video && this.props.video.link) { // videoElement = // <video width="320" height="240" controls> // <source src={this.props.video.link} type="video/mp4"/> // Your browser does not support the video tag // </video> //} return ( React.createElement("article", null, headingElement, "//", bodyElement, "//", imageElement, "//", videoElement ) ); }
render: function () { var posts = [], post, i = 0, postsLength = this.props.blogPosts.length; for (; i < postsLength; i += 1) { post = this.props.blogPosts[i]; posts.push(React.createElement(Post, { key: 'k' + post.assetId, item: post} )); } return ( React.createElement("section", null, React.createElement("div", null, post ) ) ); }
render: function () { var that = this; return ( React.createElement("div", null, this.state.blogData.map(function(post) { return ( React.createElement(Card, {onClick: that.deletePerson.bind(null, post), post: post}) ) }, this) ) ) }
define(function (require) { var React = require('react.min'), Heading = React.createClass({displayName: "Heading", render: function() { return ( React.createElement("div", null, React.createElement("h1", null, this.props.item.heading), React.createElement("h2", null, this.props.item.subHeading) ) ); } }); return React.createClass({ render: function () { var headingElement, bodyElement, imageElement, videoElement, video, postId = 'post_' + this.props.item.assetId; if (this.props.item.heading || this.props.item.subHeading) { headingElement = React.createElement(Heading, {heading: this.props.item.heading, subHeading: this.props.item.subHeading} ) } //if (this.props.body) { // bodyElement = // <Body body={this.props.body} // /> //} // //if (this.props.image && this.props.image.figure && this.props.image.alt) { // imageElement = // <img src={this.props.figure} alt={this.props.alt} width='60%' // /> //} // //if (this.props.video && this.props.video.link) { // videoElement = // <video width="320" height="240" controls> // <source src={this.props.video.link} type="video/mp4"/> // Your browser does not support the video tag // </video> //} return ( React.createElement("article", null, headingElement, "//", bodyElement, "//", imageElement, "//", videoElement ) ); } }); });
define(function (require) { var Image = require('image'), React = require('react.min'); // var Heading = React.createClass({ // render: function () { // return ( // <div> // <h1>{this.props.heading}</h1> // <h2>{this.props.subHeading}</h2> // </div> // ); // } // }); // // var Body = React.createClass({ // render: function () { // return ( // <div dangerouslySetInnerHTML={{__html: this.props.body}} /> // ); // } // }); return React.createClass({ render: function () { var imageComponment, headingComponment, bodyComponment; if (this.props.post.heading || this.props.post.subHeading) { headingComponment = React.createElement(Heading, {heading: this.props.post.heading, subHeading: this.props.post.subHeading} ) } if (this.props.post.image && this.props.post.image.figure) { imageComponment = React.createElement(Image, { image: this.props.post.image} ) } if(this.props.post.body) { bodyComponment = React.createElement(Body, { body: this.props.post.body} ) } return ( React.createElement("article", {className: "blogPost"}, headingComponment, imageComponment, bodyComponment, React.createElement("button", {onClick: this.props.onClick}, "Delete Me") ) ) } }); });
this.state.blogData.map(function(post) { return ( React.createElement(Card, {onClick: that.deletePerson.bind(null, post), post: post}) ) }, this)
define(function (require) { var Image = require('image'), React = require('react.min'); // var Heading = React.createClass({ // render: function () { // return ( // <div> // <h1>{this.props.heading}</h1> // <h2>{this.props.subHeading}</h2> // </div> // ); // } // }); // // var Body = React.createClass({ // render: function () { // return ( // <div dangerouslySetInnerHTML={{__html: this.props.body}} /> // ); // } // }); return React.createClass({ render: function () { var imageComponment, headingComponment, bodyComponment; if (this.props.post.heading || this.props.post.subHeading) { headingComponment = React.createElement(Heading, {heading: this.props.post.heading, subHeading: this.props.post.subHeading} ) } if (this.props.post.image && this.props.post.image.figure) { imageComponment = React.createElement(Image, { image: this.props.post.image} ) } if(this.props.post.body) { bodyComponment = React.createElement(Body, { body: this.props.post.body} ) } return ( React.createElement("article", {className: "blogPost"}, headingComponment, imageComponment, bodyComponment, React.createElement("button", {onClick: this.props.onClick}, "Delete Me") ) ) } }); var App = React.createClass({displayName: "App", deletePerson: function (post) { this.state.blogData.splice(this.state.blogData.indexOf(post), 1); this.setState({blogData: this.state.blogData}); }, getInitialState: function() { return { blogData: this.props.blogData.splice(0) } }, render: function () { var that = this; return ( React.createElement("div", null, this.state.blogData.map(function(post) { return ( React.createElement(Card, {onClick: that.deletePerson.bind(null, post), post: post}) ) }, this) ) ) } }) React.render(React.createElement(App, {blogData: blogData}), document.body); });