Featuring from Featured Tab

This commit is contained in:
Belen Curcio
2017-09-08 18:55:11 -03:00
parent 1f6da44b25
commit 7f85ceb566
3 changed files with 51 additions and 0 deletions
@@ -0,0 +1,17 @@
.button {
/* TODO: figure out the best location to include the `reset.css` */
composes: buttonReset from "coral-framework/styles/reset.css";
color: #767676;
margin-right: 10px;
}
.button.featured {
color: #10589b;
}
.icon {
font-size: 18px;
vertical-align: top;
}
@@ -0,0 +1,26 @@
import React from 'react';
import cn from 'classnames';
import styles from './Button.css';
import {pluginName} from '../../package.json';
import {can} from 'plugin-api/beta/client/services';
import {withTags} from 'plugin-api/beta/client/hocs';
import {Icon} from 'plugin-api/beta/client/components/ui';
const Button = (props) => {
const {alreadyTagged, deleteTag, postTag, user} = props;
return can(user, 'MODERATE_COMMENTS') ? (
<button
className={cn([`${pluginName}-tag-button`, styles.button, {[styles.featured] : alreadyTagged}])}
onClick={alreadyTagged ? deleteTag : postTag} >
{alreadyTagged ?
<Icon name="star" className={styles.icon} /> :
<Icon name="star_border" className={styles.icon} />
}
</button>
) : null ;
};
export default withTags('featured')(Button);
@@ -5,6 +5,7 @@ import {t, timeago} from 'plugin-api/beta/client/services';
import {Slot, CommentAuthorName} from 'plugin-api/beta/client/components';
import {Icon} from 'plugin-api/beta/client/components/ui';
import {pluginName} from '../../package.json';
import Button from './Button';
class Comment extends React.Component {
@@ -48,6 +49,13 @@ class Comment extends React.Component {
asset={asset}
inline
/>
<Button
root={root}
data={data}
comment={comment}
asset={asset}
/>
</div>
<div className={cn(styles.actionsContainer, `${pluginName}-comment-actions`)}>
<button className={cn(styles.goTo, `${pluginName}-comment-go-to`)} onClick={this.viewComment}>