Skip to content

Commit

Permalink
[Upd #113] Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
LaChope committed Mar 31, 2022
1 parent 83c7b29 commit 37c5b83
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .storybook/preview.js
Expand Up @@ -73,15 +73,15 @@ const options = {
icons: [
{
id: Constants.ICONS.QUESTION_HELP,
behavior: Constants.ICON_BEHAVIOR.ON_HOVER,
behavior: Constants.ICON_BEHAVIOR.ENABLE,
},
{
id: Constants.ICONS.QUESTION_LINK,
behavior: Constants.ICON_BEHAVIOR.ON_HOVER,
behavior: Constants.ICON_BEHAVIOR.ENABLE,
},
{
id: Constants.ICONS.QUESTION_COMMENTS,
behavior: Constants.ICON_BEHAVIOR.ON_HOVER,
behavior: Constants.ICON_BEHAVIOR.ENABLE,
},
],
};
Expand Down
10 changes: 7 additions & 3 deletions src/components/comment/CommentView.jsx
Expand Up @@ -99,16 +99,20 @@ const CommentView = (props) => {
};

const handleCommentBinMouseEnter = () => {
setShowRecycleBin(!showRecycleBin)
setShowRecycleBin(true)
}

const handleCommentBinMouseLeave = () => {
setShowRecycleBin(false)
}

const handleDeleteCommentClick = () => {
props.onDeleteQuestionComment(props.index);
props.onDeleteViewComment();
}

return (
<div className="comment-content" onMouseEnter={handleCommentBinMouseEnter} onMouseLeave={handleCommentBinMouseEnter}>
<div className="comment-content" onMouseEnter={handleCommentBinMouseEnter} onMouseLeave={handleCommentBinMouseLeave}>
<div className="row">
<div
className="col-auto comment-author"
Expand Down Expand Up @@ -140,7 +144,7 @@ CommentView.propTypes = {
timestamp: PropTypes.string.isRequired,
commentValue: PropTypes.string.isRequired,
onDeleteQuestionComment: PropTypes.func.isRequired,
onDeleteViewComment: PropTypes.func.isRequired,
onDeleteViewComment: PropTypes.func,
index: PropTypes.number.isRequired
};

Expand Down
4 changes: 2 additions & 2 deletions src/components/comment/QuestionCommentIcon.jsx
Expand Up @@ -65,7 +65,7 @@ const QuestionCommentIcon = (props) => {

const handleOverlayClick = (e) => {
handleStopPropagationClick(e);
setShowOverlay(!showOverlay);
setShowOverlay(!showOverlay);
};

const getCommentsLength = () => {
Expand All @@ -88,7 +88,7 @@ const QuestionCommentIcon = (props) => {

return (
<div ref={overlayTarget} onClick={handleStopPropagationClick}>
<span data-testid="comment-bubble" ref={target} onClick={handleOverlayClick}>
<span className="comment-bubble" ref={target} onClick={handleOverlayClick}>
<CommentBubble/>
{getCommentsLength() > 0 ? <Badge className="comment-badge" pill variant="primary">{getCommentsLength()}</Badge> : null}
</span>
Expand Down

0 comments on commit 37c5b83

Please sign in to comment.