From c7c1ca9dbf650c17dd0686f3ecd6236cfcd942b2 Mon Sep 17 00:00:00 2001 From: Mannuel Ferreira Date: Fri, 10 Jul 2015 20:48:35 +0200 Subject: [PATCH 1/4] first commit --- .gitignore | 1 + .idea/workspace.xml | 375 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 376 insertions(+) create mode 100644 .idea/workspace.xml diff --git a/.gitignore b/.gitignore index daeba5f9..3f4e088b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *~ node_modules +./idea .DS_Store diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 00000000..645e4fbb --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,375 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1436553156830 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From d17ae6ab7998bebf24dceebe2fc8873773fbbe81 Mon Sep 17 00:00:00 2001 From: Mannuel Ferreira Date: Fri, 10 Jul 2015 21:11:47 +0200 Subject: [PATCH 2/4] tutorial 1 done --- .idea/workspace.xml | 135 +++++++++++++++++++++++------------ public/index.html | 2 +- public/scripts/tutorial1.jsx | 14 ++++ 3 files changed, 105 insertions(+), 46 deletions(-) create mode 100644 public/scripts/tutorial1.jsx diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 645e4fbb..89658b1e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,11 @@ - + + + + + @@ -133,6 +134,8 @@ @@ -144,9 +147,10 @@ - @@ -190,6 +194,38 @@ @@ -256,10 +293,10 @@ - - + + - + @@ -299,15 +336,15 @@ - + - - + + - + @@ -315,7 +352,7 @@ - + @@ -323,23 +360,31 @@ - + - - + + - + - - + + - + + + + + + + + + @@ -347,15 +392,15 @@ - + - - + + - + @@ -363,10 +408,10 @@ - + - - + + diff --git a/public/index.html b/public/index.html index c6220169..5621e4c8 100644 --- a/public/index.html +++ b/public/index.html @@ -11,6 +11,6 @@
- + diff --git a/public/scripts/tutorial1.jsx b/public/scripts/tutorial1.jsx new file mode 100644 index 00000000..3c6b3c7e --- /dev/null +++ b/public/scripts/tutorial1.jsx @@ -0,0 +1,14 @@ +var CommentBox = React.createClass({ + render: function() { + return ( +
+ Hello, world! I am a CommentBox. +
+ ); + } +}); + +React.render( + , + document.getElementById('content') +); From a82b5c0c78270f68d3442a7ed1fb63cc7ba5e2ef Mon Sep 17 00:00:00 2001 From: Mannuel Ferreira Date: Fri, 10 Jul 2015 22:40:30 +0200 Subject: [PATCH 3/4] step 7 --- .idea/workspace.xml | 117 +++++++---------------------------- public/scripts/tutorial1.jsx | 38 +++++++++++- public/scripts/tutorial2.jsx | 1 + 3 files changed, 62 insertions(+), 94 deletions(-) create mode 100644 public/scripts/tutorial2.jsx diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 89658b1e..64a0ccf7 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,8 +2,9 @@ - + + @@ -28,8 +29,8 @@ - - + + @@ -38,88 +39,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -134,6 +55,8 @@ - + - - + + - + @@ -392,7 +315,7 @@ - + @@ -400,7 +323,7 @@ - + @@ -408,10 +331,18 @@ + + + + + + + + - - + + diff --git a/public/scripts/tutorial1.jsx b/public/scripts/tutorial1.jsx index 3c6b3c7e..e8c369a1 100644 --- a/public/scripts/tutorial1.jsx +++ b/public/scripts/tutorial1.jsx @@ -1,8 +1,44 @@ +var CommentList = React.createClass({ + render: function() { + return ( +
+ Wow this is not bad at all. + Yeah I agree. +
+ ); + } +}); + +var CommentForm = React.createClass({ + render: function() { + return ( +
+ Hello, world! I am a CommentForm. +
+ ); + } +}); + +var Comment = React.createClass({ + render: function() { + return ( +
+

+ {this.props.author} +

+ {marked(this.props.children.toString())} +
+ ); + } +}); + var CommentBox = React.createClass({ render: function() { return (
- Hello, world! I am a CommentBox. +

Comments

+ +
); } diff --git a/public/scripts/tutorial2.jsx b/public/scripts/tutorial2.jsx new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/public/scripts/tutorial2.jsx @@ -0,0 +1 @@ + From 676301084526c86421f4bc71f291d8a81f2e6ad1 Mon Sep 17 00:00:00 2001 From: Mannuel Ferreira Date: Tue, 14 Jul 2015 00:04:02 +0200 Subject: [PATCH 4/4] hooked up the data model --- .editorconfig | 2 +- .idea/workspace.xml | 117 ++++++++++++++--------------------- npm-debug.log | 18 ++++++ public/scripts/tutorial1.jsx | 83 ++++++++++++++----------- 4 files changed, 114 insertions(+), 106 deletions(-) create mode 100644 npm-debug.log diff --git a/.editorconfig b/.editorconfig index 052e5ee7..c6c37106 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,7 +4,7 @@ root = true [*] charset = utf-8 end_of_line = lf -indent_size = 4 +indent_size = 2 indent_style = space insert_final_newline = true trim_trailing_whitespace = true diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 64a0ccf7..4e83c1ac 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,8 +2,7 @@ - - + @@ -29,8 +28,8 @@ - - + + @@ -39,8 +38,18 @@ - - + + + + + + + + + + + + @@ -58,6 +67,7 @@ @@ -70,10 +80,9 @@ - @@ -117,38 +126,6 @@ - + @@ -248,17 +225,6 @@ - - - - - - - - - - - @@ -267,14 +233,6 @@ - - - - - - - - @@ -315,7 +273,7 @@ - + @@ -323,26 +281,45 @@ - + - - + + - - + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/npm-debug.log b/npm-debug.log new file mode 100644 index 00000000..ca792ae9 --- /dev/null +++ b/npm-debug.log @@ -0,0 +1,18 @@ +0 info it worked if it ends with ok +1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start', 'server.js' ] +2 info using npm@1.4.28 +3 info using node@v0.10.37 +4 verbose node symlink /usr/bin/node +5 error Error: ENOENT, open '/home/mannuel/labs.themwebs/react-tutorial/node_modules/server.js/package.json' +6 error If you need help, you may report this *entire* log, +6 error including the npm and node versions, at: +6 error +7 error System Linux 3.13.0-57-generic +8 error command "/usr/bin/node" "/usr/bin/npm" "start" "server.js" +9 error cwd /home/mannuel/labs.themwebs/react-tutorial +10 error node -v v0.10.37 +11 error npm -v 1.4.28 +12 error path /home/mannuel/labs.themwebs/react-tutorial/node_modules/server.js/package.json +13 error code ENOENT +14 error errno 34 +15 verbose exit [ 34, true ] diff --git a/public/scripts/tutorial1.jsx b/public/scripts/tutorial1.jsx index e8c369a1..7517b1a0 100644 --- a/public/scripts/tutorial1.jsx +++ b/public/scripts/tutorial1.jsx @@ -1,50 +1,63 @@ + +var data = [ + { author: "Mannuel Ferreira", text: "This is not bad at all"}, + { author: "Denton Pretorius", text: "Yeah I agree"} +]; + var CommentList = React.createClass({ - render: function() { - return ( -
- Wow this is not bad at all. - Yeah I agree. -
+ render: function () { + var commentNodes = this.props.data.map(function (comment){ + return ( + + {comment.text} + ); - } + }); + return ( +
+ {commentNodes} +
+ ) + } }); var CommentForm = React.createClass({ - render: function() { - return ( -
- Hello, world! I am a CommentForm. -
- ); - } + render: function () { + return ( +
+ Hello, world! I am a CommentForm. +
+ ); + } }); var Comment = React.createClass({ - render: function() { - return ( -
-

- {this.props.author} -

- {marked(this.props.children.toString())} -
- ); - } + render: function () { + var rawMarkup = marked(this.props.children.toString(), {sanitize: true}) + return ( +
+

+ {this.props.author} +

+ +
+ ); + } }); var CommentBox = React.createClass({ - render: function() { - return ( -
-

Comments

- - -
- ); - } + render: function () { + return ( +
+

Comments

+ + +
+ ); + } }); React.render( - , - document.getElementById('content') + , + document.getElementById('content') );