excludeIf no featured tags

This commit is contained in:
Belen Curcio
2017-09-05 16:19:46 -03:00
parent 5953ef1695
commit 12be487783
2 changed files with 18 additions and 20 deletions
@@ -3,7 +3,6 @@ import cn from 'classnames';
import styles from './Tag.css';
import Tooltip from './Tooltip';
import {t} from 'plugin-api/beta/client/services';
import {isTagged} from 'plugin-api/beta/client/utils';
export default class Tag extends React.Component {
constructor() {
@@ -35,14 +34,10 @@ export default class Tag extends React.Component {
<div className={styles.noSelect} onMouseEnter={this.showTooltip}
onMouseLeave={this.hideTooltip} onTouchStart={this.showTooltip}
onTouchEnd={this.hideTooltip}>
{
isTagged(this.props.comment.tags, 'FEATURED') ? (
<span
className={cn(styles.tag, styles.noSelect, {[styles.on]: tooltip})}>
{t('talk-plugin-featured-comments.featured')}
</span>
) : null
}
<span
className={cn(styles.tag, styles.noSelect, {[styles.on]: tooltip})}>
{t('talk-plugin-featured-comments.featured')}
</span>
{tooltip && <Tooltip className={styles.tooltip} />}
</div>
);
@@ -1,15 +1,18 @@
import {gql} from 'react-apollo';
import {compose, gql} from 'react-apollo';
import Tag from '../components/Tag';
import {withFragments} from 'plugin-api/beta/client/hocs';
import {isTagged} from 'plugin-api/beta/client/utils';
import {withFragments, excludeIf} from 'plugin-api/beta/client/hocs';
export default withFragments({
comment: gql`
fragment TalkFeaturedComments_Tag_comment on Comment {
tags {
tag {
name
export default compose(
withFragments({
comment: gql`
fragment TalkFeaturedComments_Tag_comment on Comment {
tags {
tag {
name
}
}
}
}
`
})(Tag);
`}),
excludeIf((props) => !isTagged(props.comment.tags, 'FEATURED'))
)(Tag);