mirror of
https://github.com/wassname/talk.git
synced 2026-08-13 12:40:11 +08:00
Stable Version with reducers and actions
This commit is contained in:
@@ -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 (
|
||||
|
||||
@@ -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;
|
||||
}, {});
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user