summaryrefslogtreecommitdiffstats
path: root/webapp/components/common
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-05-11 21:12:33 +0900
committerJoram Wilander <jwawilander@gmail.com>2017-05-11 08:12:33 -0400
commit81b2fd99825b1f92f7aad3591b95425656497a16 (patch)
treeec1a3c861dae13ff4c1ecd962a5d6bc72060d65f /webapp/components/common
parent4f589e077c82da00dd505319ddcf3565c699d4e6 (diff)
downloadchat-81b2fd99825b1f92f7aad3591b95425656497a16.tar.gz
chat-81b2fd99825b1f92f7aad3591b95425656497a16.tar.bz2
chat-81b2fd99825b1f92f7aad3591b95425656497a16.zip
add IDs for reply arrows at center and RHS (#6311)
Diffstat (limited to 'webapp/components/common')
-rw-r--r--webapp/components/common/comment_icon.jsx55
1 files changed, 55 insertions, 0 deletions
diff --git a/webapp/components/common/comment_icon.jsx b/webapp/components/common/comment_icon.jsx
new file mode 100644
index 000000000..e8be773e5
--- /dev/null
+++ b/webapp/components/common/comment_icon.jsx
@@ -0,0 +1,55 @@
+// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import React from 'react';
+import Constants from 'utils/constants.jsx';
+import * as Utils from 'utils/utils.jsx';
+
+export default function CommentIcon(props) {
+ let commentCountSpan = '';
+ let iconStyle = 'comment-icon__container';
+ if (props.commentCount > 0) {
+ iconStyle += ' icon--show';
+ commentCountSpan = (
+ <span className='comment-count'>
+ {props.commentCount}
+ </span>
+ );
+ } else if (props.searchStyle !== '') {
+ iconStyle = iconStyle + ' ' + props.searchStyle;
+ }
+
+ let commentIconId = props.idPrefix;
+ if (props.idCount > -1) {
+ commentIconId += props.idCount;
+ }
+
+ return (
+ <a
+ id={Utils.createSafeId(commentIconId)}
+ href='#'
+ className={iconStyle}
+ onClick={props.handleCommentClick}
+ >
+ <span
+ className='comment-icon'
+ dangerouslySetInnerHTML={{__html: Constants.REPLY_ICON}}
+ />
+ {commentCountSpan}
+ </a>
+ );
+}
+
+CommentIcon.propTypes = {
+ idPrefix: React.PropTypes.string.isRequired,
+ idCount: React.PropTypes.number,
+ handleCommentClick: React.PropTypes.func.isRequired,
+ searchStyle: React.PropTypes.string,
+ commentCount: React.PropTypes.number
+};
+
+CommentIcon.defaultProps = {
+ idCount: -1,
+ searchStyle: '',
+ commentCount: 0
+}; \ No newline at end of file