show disabled score & votes button for guest

This commit is contained in:
igoradamenko
2018-05-03 00:39:42 +03:00
parent 7975cdee15
commit e2d875aa79
3 changed files with 28 additions and 18 deletions
@@ -0,0 +1,6 @@
.comment__vote_disabled {
&, &:hover {
border-top-color: #ededed;
cursor: not-allowed;
}
}
+21 -18
View File
@@ -254,26 +254,24 @@ export default class Comment extends Component {
)
}
{
!isGuest && (
<span className={b('comment__score', {}, { view: o.score.view })}>
<span
className={b('comment__vote', {}, { type: 'up', selected: scoreIncreased })}
onClick={this.increaseScore}
>Vote up</span>
<span className={b('comment__score', {}, { view: o.score.view })}>
<span
className={b('comment__vote', {}, { type: 'up', selected: scoreIncreased, disabled: isGuest })}
onClick={this.increaseScore}
title={isGuest ? 'Only authorized users are allowed to vote' : null}
>Vote up</span>
<span className="comment__score-value">
{o.score.sign}{o.score.value}
</span>
<span className="comment__score-value">
{o.score.sign}{o.score.value}
</span>
<span
className={b('comment__vote', {}, { type: 'down', selected: scoreDecreased })}
onClick={this.decreaseScore}
>Vote down</span>
</span>
)
}
<span
className={b('comment__vote', {}, { type: 'down', selected: scoreDecreased, disabled: isGuest })}
onClick={this.decreaseScore}
title={isGuest ? 'Only authorized users are allowed to vote' : null}
>Vote down</span>
</span>
</div>
<div
@@ -353,7 +351,12 @@ export default class Comment extends Component {
{
isInputVisible && (
<Input mix="comment__input" onSubmit={this.onReply} pid={o.id} autoFocus/>
<Input
mix="comment__input"
onSubmit={this.onReply}
pid={o.id}
autoFocus
/>
)
}
</div>
+1
View File
@@ -25,6 +25,7 @@ require('./__time/comment__time.scss');
require('./__username/comment__username.scss');
require('./__vote/comment__vote.scss');
require('./__vote/_disabled/comment__vote_disabled.scss');
require('./__vote/_selected/comment__vote_selected.scss');
require('./__vote/_type/_down/comment__vote_type_down.scss');
require('./__vote/_type/_up/comment__vote_type_up.scss');