react-templates/playground/intro.js

38 lines
992 B
JavaScript
Raw Normal View History

2014-12-02 17:59:03 +01:00
/**
* Created by avim on 12/2/2014.
*/
2014-12-03 10:36:34 +01:00
'use strict';
2014-12-02 17:59:03 +01:00
var React = require('react/addons');
var _ = require('lodash');
var introTemplate = require('./intro.rt.js');
2014-12-04 17:09:27 +01:00
//var path = require('path');
2014-12-02 17:59:03 +01:00
var fs = require('fs');
2014-12-04 17:09:27 +01:00
/*eslint no-path-concat:0*/
2014-12-03 10:36:34 +01:00
var helloCode = fs.readFileSync(__dirname + '/samples/hello.code').toString();
var helloRT = fs.readFileSync(__dirname + '/samples/hello.rt').toString();
var todoCode = fs.readFileSync(__dirname + '/samples/todo.code').toString();
var todoRT = fs.readFileSync(__dirname + '/samples/todo.rt').toString();
2014-12-02 17:59:03 +01:00
var samples = [
2014-12-03 10:36:34 +01:00
[helloCode, helloRT],
[todoCode, todoRT]
2014-12-02 17:59:03 +01:00
];
2014-12-03 10:36:34 +01:00
samples = _.map(samples, function (tuple) {
return {templateProps: tuple[0], templateHTML: tuple[1]};
2014-12-02 17:59:03 +01:00
});
var intro = React.createClass({
2014-12-03 10:36:34 +01:00
displayName: 'Intro',
getInitialState: function () {
2014-12-02 17:59:03 +01:00
return {
2014-12-03 10:36:34 +01:00
samples: samples
};
2014-12-02 17:59:03 +01:00
},
render: function () {
return introTemplate.apply(this);
}
});
module.exports = intro;