Working respect count

This commit is contained in:
Belen Curcio
2017-03-30 19:41:40 -03:00
parent 78d072a04a
commit 3d245c2029
2 changed files with 11 additions and 9 deletions
+10 -7
View File
@@ -2,25 +2,28 @@ import React from 'react';
import styles from './style.css';
import {Icon} from 'coral-ui';
export default (props) => {
const handleClick = () => {
// props.actions.clic kButton();
const getActionSummary = (type, comment) => comment.action_summaries
.filter((a) => a.__typename === type)[0];
export default (props) => {
const {comment} = props.context;
const handleClick = () => {
props.context.postRespect({
item_id: props.context.comment.id,
item_id: comment.id,
item_type: 'COMMENTS'
});
};
const {clicked} = props.state.respect;
const respectActionSummary = getActionSummary('RespectActionSummary', comment);
return (
<div className={styles.Respect} key={props.key}>
<button
className={clicked ? styles.clicked : ''}
onClick={handleClick}>
Respect
<Icon name="done"/>
<span>9</span>
{respectActionSummary ? <span>{respectActionSummary.count}</span> : null}
</button>
</div>
);