Stable Version with reducers and actions

This commit is contained in:
Belen Curcio
2017-03-29 16:24:09 -03:00
parent 6bb9d23fdc
commit 5dc9811e06
3 changed files with 11 additions and 10 deletions
@@ -2,9 +2,6 @@ import React, {Component} from 'react';
import { importer as injectPlugins } from 'coral-framework/helpers/importer';
class Slot extends Component {
componentDidMount() {
console.log('Slot Mounted');
}
render() {
const {fill} = this.props;
return (
+10 -6
View File
@@ -63,7 +63,7 @@ function importer (fill) {
.map(addProps)
.filter(filterBySlot)
.reduce((entry, plugin, i) => {
entry.push(context(plugin.key)(plugin.props));
entry.push(context(plugin.key)({...plugin.props, key: i}));
return entry;
}, []);
}
@@ -85,25 +85,29 @@ function shapeData(test) {
};
}
function actionsImporter () {
const context = require.context('plugins', true, /\.\/(.*)\/client\/actions.js$/);
function importAll(context) {
return context
.keys()
.map(key => shapeData(key))
.reduce((entry, actionsPlugin, i) => {
.reduce((entry, actionsPlugin) => {
entry[actionsPlugin.name] = context(actionsPlugin.key);
return entry;
}, {});
}
function actionsImporter () {
return importAll(require.context('plugins', true, /\.\/(.*)\/client\/actions.js$/))
}
function reducersImporter () {
const context = require.context('plugins', true, /\.\/(.*)\/client\/reducer.js$/);
return context
.keys()
.map(key => shapeData(key))
.reduce((entry, reducerPlugin, i) => {
.reduce((entry, reducerPlugin) => {
entry[reducerPlugin.name] = context(reducerPlugin.key);
return entry;
}, {});
+1 -1
View File
@@ -2,7 +2,7 @@ import React from 'react';
import styles from './style.css';
export default (props) => (
<div className={styles.Respect}>
<div className={styles.Respect} key={props.key}>
<button>Respect</button>
</div>
);