cluedin-widget
Version:
This is the project for creating and managing widgets in CluedIn.
26 lines (22 loc) • 840 B
JSX
import React, { Component } from 'react';
import Loader from './Loader.jsx';
export default class FollowButton extends Component {
render() {
const { entity, isDoingFollowingRequest, allFollowers, onFollow, onUnFollow } = this.props;
if ( isDoingFollowingRequest ) {
return (<a className="cluedIn_btn cluedIn_btn-primary"><Loader></Loader></a>);
}
var hasFound = allFollowers.filter( ( f )=> {
return f.Entity.EntityId === entity.id;
} ).length;
if ( hasFound ) {
return (
<a className="cluedIn_btn cluedIn_btn-primary" onClick={onUnFollow}>Unfollow</a>
);
} else {
return (
<a className="cluedIn_btn cluedIn_btn-primary" onClick={onFollow}>Follow</a>
);
}
}
}