mirror of
https://github.com/wassname/talk.git
synced 2026-07-16 11:22:16 +08:00
replaced eslint:recommended with prettier
This commit is contained in:
@@ -1,58 +1,62 @@
|
||||
import React from 'react';
|
||||
import cn from 'classnames';
|
||||
import styles from './ModActionButton.css';
|
||||
import {pluginName} from '../../package.json';
|
||||
import {t} from 'plugin-api/beta/client/services';
|
||||
import {Icon} from 'plugin-api/beta/client/components/ui';
|
||||
import { pluginName } from '../../package.json';
|
||||
import { t } from 'plugin-api/beta/client/services';
|
||||
import { Icon } from 'plugin-api/beta/client/components/ui';
|
||||
|
||||
export class ModActionButton extends React.Component {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.state = {
|
||||
on: false
|
||||
on: false,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
handleMouseEnter = (e) => {
|
||||
handleMouseEnter = e => {
|
||||
e.preventDefault();
|
||||
this.setState({
|
||||
on: true
|
||||
on: true,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
handleMouseLeave = (e) => {
|
||||
handleMouseLeave = e => {
|
||||
e.preventDefault();
|
||||
this.setState({
|
||||
on: false
|
||||
on: false,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
handleDeleteTag = () => {
|
||||
this.props.deleteTag();
|
||||
this.props.closeMenu();
|
||||
}
|
||||
};
|
||||
|
||||
handlePostTag = () => {
|
||||
this.props.postTag();
|
||||
this.props.closeMenu();
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const {alreadyTagged} = this.props;
|
||||
const {handleDeleteTag, handlePostTag} = this;
|
||||
const { alreadyTagged } = this.props;
|
||||
const { handleDeleteTag, handlePostTag } = this;
|
||||
|
||||
return (
|
||||
<button className={cn(`${pluginName}-tag-button`, styles.button, {[styles.featured] : alreadyTagged})}
|
||||
<button
|
||||
className={cn(`${pluginName}-tag-button`, styles.button, {
|
||||
[styles.featured]: alreadyTagged,
|
||||
})}
|
||||
onClick={alreadyTagged ? handleDeleteTag : handlePostTag}
|
||||
onMouseEnter={this.handleMouseEnter}
|
||||
onMouseLeave={this.handleMouseLeave} >
|
||||
|
||||
onMouseLeave={this.handleMouseLeave}
|
||||
>
|
||||
{alreadyTagged ? (
|
||||
<span className={styles.approved}>
|
||||
<Icon name="star" className={styles.icon} />
|
||||
{!this.state.on ? t('talk-plugin-featured-comments.featured') : t('talk-plugin-featured-comments.un_feature')}
|
||||
{!this.state.on
|
||||
? t('talk-plugin-featured-comments.featured')
|
||||
: t('talk-plugin-featured-comments.un_feature')}
|
||||
</span>
|
||||
) : (
|
||||
<span>
|
||||
@@ -60,11 +64,9 @@ export class ModActionButton extends React.Component {
|
||||
{t('talk-plugin-featured-comments.feature')}
|
||||
</span>
|
||||
)}
|
||||
|
||||
</button>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default ModActionButton;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user