mirror of
https://github.com/wassname/talk.git
synced 2026-08-05 13:30:26 +08:00
Adding FeaturedButton (we already have Button with Coral-UI)
This commit is contained in:
@@ -5,7 +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';
|
||||
import FeaturedButton from '../containers/FeaturedButton';
|
||||
|
||||
class Comment extends React.Component {
|
||||
|
||||
@@ -50,7 +50,7 @@ class Comment extends React.Component {
|
||||
inline
|
||||
/>
|
||||
|
||||
<Button
|
||||
<FeaturedButton
|
||||
root={root}
|
||||
data={data}
|
||||
comment={comment}
|
||||
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
import React from 'react';
|
||||
import cn from 'classnames';
|
||||
import styles from './Button.css';
|
||||
import styles from './FeaturedButton.css';
|
||||
import {pluginName} from '../../package.json';
|
||||
import {can} from 'plugin-api/beta/client/services';
|
||||
import {Icon} from 'plugin-api/beta/client/components/ui';
|
||||
|
||||
const Button = (props) => {
|
||||
const FeaturedButton = (props) => {
|
||||
const {alreadyTagged, deleteTag, postTag, user} = props;
|
||||
|
||||
return can(user, 'MODERATE_COMMENTS') ? (
|
||||
@@ -22,4 +22,4 @@ const Button = (props) => {
|
||||
) : null ;
|
||||
};
|
||||
|
||||
export default Button;
|
||||
export default FeaturedButton;
|
||||
@@ -3,10 +3,9 @@ import cn from 'classnames';
|
||||
import styles from './ModActionButton.css';
|
||||
import {pluginName} from '../../package.json';
|
||||
import {t} from 'plugin-api/beta/client/services';
|
||||
import {withTags} from 'plugin-api/beta/client/hocs';
|
||||
import {Icon} from 'plugin-api/beta/client/components/ui';
|
||||
|
||||
export class Button extends React.Component {
|
||||
export class ModActionButton extends React.Component {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
@@ -56,5 +55,5 @@ export class Button extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default withTags('featured')(Button);
|
||||
export default ModActionButton;
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
import Button from '../components/Button';
|
||||
import {withTags} from 'plugin-api/beta/client/hocs';
|
||||
|
||||
export default withTags('featured')(Button);
|
||||
@@ -0,0 +1,4 @@
|
||||
import FeaturedButton from '../components/FeaturedButton';
|
||||
import {withTags} from 'plugin-api/beta/client/hocs';
|
||||
|
||||
export default withTags('featured')(FeaturedButton);
|
||||
@@ -1,10 +1,12 @@
|
||||
import {compose} from 'react-apollo';
|
||||
import {excludeIf} from 'plugin-api/beta/client/hocs';
|
||||
import {can} from 'plugin-api/beta/client/services';
|
||||
|
||||
import Button from '../components/Button';
|
||||
import {can} from 'plugin-api/beta/client/services';
|
||||
import {excludeIf, withTags} from 'plugin-api/beta/client/hocs';
|
||||
|
||||
const enhance = compose(
|
||||
excludeIf((props) => !can(props.user, 'MODERATE_COMMENTS')),
|
||||
withTags('featured')
|
||||
);
|
||||
|
||||
export default enhance(Button);
|
||||
|
||||
Reference in New Issue
Block a user