-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
'presets' : ['es2015', 'react'] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title></title> | ||
</head> | ||
<body> | ||
<script src="./bundle.js"></script> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** @jsx h */ | ||
import './index.html'; | ||
import {h, Cream, create, inject, _container } from '../../../'; | ||
import Store from './store'; | ||
import Record from './record'; | ||
|
||
var c =create({ | ||
element : document.body, | ||
elementId : 'application', | ||
elementClass : 'cake-application' | ||
}) | ||
.route('/', 'records.index') | ||
|
||
Cream.extend({ | ||
_namespace: 'records.index', | ||
|
||
render: function() { | ||
return ( | ||
<div> | ||
<h2>List of Records</h2> | ||
{Store.store.map(function(r, i) { | ||
return ( | ||
<Record title={i + '. ' + r.title}> | ||
<em>{r.content}</em> | ||
</Record> | ||
); | ||
}) | ||
} | ||
</div> | ||
); | ||
} | ||
}); | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** @jsx h */ | ||
import {h, Cream} from '../../../'; | ||
|
||
export default Cream.extend({ | ||
render: function() { | ||
return ( | ||
<div> | ||
<h3>{this.props.title}</h3> | ||
<div>{this.props.children}</div> | ||
</div> | ||
); | ||
} | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {Cream} from '../../../'; | ||
|
||
export default Cream.extend({ | ||
byId: function(id) { | ||
return this.store[id]; | ||
}, | ||
|
||
store: [ | ||
{ title: 'First record', content: 'First record content' }, | ||
{ title: 'Second record', content: 'Second record content' }, | ||
{ title: 'Third record', content: 'Third record content' } | ||
] | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "example", | ||
"author": "Svetlana Linuxenko <linuxenko@yahoo.com> (http://www.linuxenko.pro)", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"babel-core": "^6.18.2", | ||
"babel-loader": "^6.2.8", | ||
"babel-preset-es2015": "^6.18.0", | ||
"babel-preset-react": "^6.16.0", | ||
"file-loader": "^0.9.0", | ||
"webpack": "^1.13.3" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* global __dirname */ | ||
|
||
var path = require('path'); | ||
|
||
var webpack = require('webpack'); | ||
var dir_js = path.resolve(__dirname, 'app'); | ||
var dir_build = path.resolve(__dirname, 'build'); | ||
|
||
module.exports = { | ||
entry: { | ||
app : path.resolve(dir_js, 'index.js') | ||
}, | ||
devtool: 'source-map', | ||
output: { | ||
path: dir_build, | ||
filename: 'bundle.js' | ||
}, | ||
resolveLoader: { | ||
fallback: [path.join(__dirname, 'node_modules')] | ||
}, | ||
resolve: { | ||
modulesDirectories: ['node_modules', '../../../', dir_js], | ||
fallback: [path.join(__dirname, 'node_modules')] | ||
}, | ||
devServer: { | ||
contentBase: dir_build, | ||
}, | ||
module: { | ||
loaders: [ | ||
{ | ||
loader: 'babel-loader', | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
presets : ['es2015', 'react'] | ||
}, | ||
{ | ||
test : /\.html$/, | ||
loader : 'file?name=[name].html' | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
new webpack.NoErrorsPlugin() | ||
|
||
], | ||
stats: { | ||
colors: true | ||
} | ||
}; |