Plugins have access to ParentComponent Properties

This commit is contained in:
Belen Curcio
2017-03-30 11:15:20 -03:00
parent ab6f455ec7
commit 17a8f48b4f
5 changed files with 12 additions and 8 deletions
+2 -2
View File
@@ -160,7 +160,7 @@ class Comment extends React.Component {
? <TagLabel><BestIndicator /></TagLabel>
: null }
<PubDate created_at={comment.created_at} />
<Slot fill="Comment.InfoBar" />
<Slot fill="Comment.InfoBar" {...this.props}/>
</div>
<Content body={comment.body} />
@@ -192,7 +192,7 @@ class Comment extends React.Component {
removeBest={removeBestTag} />
</IfUserCanModifyBest>
</ActionButton>
<Slot fill="Comment.Detail" />
<Slot fill="Comment.Detail" {...this.props}/>
</div>
<div className="commentActionsRight comment__action-container">
<ActionButton>
+4 -2
View File
@@ -120,7 +120,7 @@ class Embed extends Component {
return (
<div style={expandForLogin}>
<div className="commentStream">
<Slot fill="Stream"/>
<Slot fill="Stream" {...this.props} />
<TabBar onChange={this.changeTab} activeTab={activeTab}>
<Tab><Count count={asset.totalCommentCount}/></Tab>
<Tab>{lang.t('MY_COMMENTS')}</Tab>
@@ -192,7 +192,9 @@ class Embed extends Component {
showSignInDialog={this.props.showSignInDialog}
key={highlightedComment.id}
reactKey={highlightedComment.id}
comment={highlightedComment} />
comment={highlightedComment}
{...this.props}
/>
}
<NewCount
commentCount={asset.commentCount}
+2 -2
View File
@@ -4,10 +4,10 @@ import actions from 'coral-framework/actions';
class Slot extends Component {
render() {
const {fill} = this.props;
const slotProps = {...this.props, ...actions};
return (
<div>
{injectPlugins(fill)}
{injectPlugins(slotProps)}
</div>
);
}
+3 -2
View File
@@ -1,6 +1,6 @@
import {client as clientPlugins} from 'pluginsConfig';
function importer (fill) {
function importer ({fill, ...props}) {
let context,
importedFiles;
@@ -39,7 +39,8 @@ function importer (fill) {
*/
plugin.props = {
...actionsImporter(),
...getConfig(plugin.name)
...getConfig(plugin.name),
...props
};
return plugin;
@@ -3,6 +3,7 @@ import styles from './style.css';
export default (props) => (
<div className={styles.Respect} key={props.key}>
{console.log(props)}
<button>Respect</button>
</div>
);