mirror of
https://github.com/wassname/talk.git
synced 2026-06-29 03:05:24 +08:00
25 lines
750 B
JavaScript
25 lines
750 B
JavaScript
import React from 'react';
|
|
import cn from 'classnames';
|
|
import styles from './styles.css';
|
|
import {name} 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 FeaturedButton = (props) => {
|
|
const {alreadyTagged, deleteTag, postTag, user} = props;
|
|
|
|
return can(user, 'MODERATE_COMMENTS') ? (
|
|
<button
|
|
className={cn([name, styles.button, {[styles.featured] : alreadyTagged}])}
|
|
onClick={alreadyTagged ? deleteTag : postTag} >
|
|
|
|
{alreadyTagged ? <Icon name="star" /> : <Icon name="star_border" />}
|
|
|
|
</button>
|
|
) : null ;
|
|
};
|
|
|
|
export default withTags('featured')(FeaturedButton);
|
|
|