From 60905bb99d2e3ef88ba2323f102b773fdd434bb9 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 14 Jun 2017 13:02:51 -0300 Subject: [PATCH] Default Components for Slots --- client/coral-embed-stream/src/components/Comment.js | 9 +++++---- client/coral-framework/components/Slot.js | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/client/coral-embed-stream/src/components/Comment.js b/client/coral-embed-stream/src/components/Comment.js index 82befeb2a..a66b8a224 100644 --- a/client/coral-embed-stream/src/components/Comment.js +++ b/client/coral-embed-stream/src/components/Comment.js @@ -9,6 +9,7 @@ import FlagComment from 'coral-plugin-flags/FlagComment'; import {can} from 'coral-framework/services/perms'; import {TransitionGroup} from 'react-transition-group'; import cn from 'classnames'; +import styles from './Comment.css'; import { BestButton, @@ -17,14 +18,14 @@ import { commentIsBest, BestIndicator } from 'coral-plugin-best/BestButton'; -import Slot from 'coral-framework/components/Slot'; import LoadMore from './LoadMore'; +import {getEditableUntilDate} from './util'; import {TopRightMenu} from './TopRightMenu'; +import CommentContent from './CommentContent'; +import Slot from 'coral-framework/components/Slot'; import IgnoredCommentTombstone from './IgnoredCommentTombstone'; import {EditableCommentContent} from './EditableCommentContent'; import {getActionSummary, iPerformedThisAction} from 'coral-framework/utils'; -import {getEditableUntilDate} from './util'; -import styles from './Comment.css'; const isStaff = (tags) => !tags.every((t) => t.tag.name !== 'STAFF'); const hasTag = (tags, lookupTag) => !!tags.filter((t) => t.tag.name === lookupTag).length; @@ -465,7 +466,7 @@ export default class Comment extends React.Component { stopEditing={this.stopEditing} /> :
- +
} diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index 22a315623..d313193e3 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -4,10 +4,10 @@ import styles from './Slot.css'; import {connect} from 'react-redux'; import {getSlotElements} from 'coral-framework/helpers/plugins'; -function Slot ({fill, inline = false, className, plugin_config: config, ...rest}) { +function Slot ({fill, inline = false, className, plugin_config: config, defaultComponent = () => {}, ...rest}) { return (
- {getSlotElements(fill, {...rest, config})} + {getSlotElements(fill).length ? getSlotElements(fill, {...rest, config}) : defaultComponent({...rest})}
); }