don't rerender on hover for collapse/expand link
This commit is contained in:
parent
e212b52f9b
commit
03311238e8
@ -1,3 +1,15 @@
|
||||
.replies {
|
||||
margin-left: 1em;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
color: #007bff;
|
||||
}
|
||||
.comment-meta a {
|
||||
display: none;
|
||||
}
|
||||
.comment-meta:hover a {
|
||||
display: inline;
|
||||
text-decoration: none;
|
||||
color: #007bff;
|
||||
}
|
||||
|
@ -3,18 +3,13 @@ import CommentReply from './CommentReply'
|
||||
|
||||
const ExpandedComment = props => {
|
||||
return (
|
||||
<li
|
||||
className=""
|
||||
key={props.id}
|
||||
onMouseEnter={() => props.showCollapseLink(props.id, true)}
|
||||
onMouseLeave={() => props.showCollapseLink(props.id, false)}
|
||||
>
|
||||
<li key={props.id}>
|
||||
<div id="media-image" className="media bg bg-dark">
|
||||
<img alt="profile" src="anon.jpeg" height={64} />
|
||||
|
||||
<div id="media-body" className="media-body ml-3 my-auto">
|
||||
<a href="#user">username</a>
|
||||
<div className="text-white-50">
|
||||
<div className="comment-meta text-white-50">
|
||||
<small>{props.createdAt}</small>
|
||||
{props.replies.length > 0 ? (
|
||||
<a
|
||||
@ -22,7 +17,6 @@ const ExpandedComment = props => {
|
||||
className="ml-3"
|
||||
style={{
|
||||
fontVariant: 'small-caps',
|
||||
display: props.displayCollapse || 'none',
|
||||
}}
|
||||
onClick={() =>
|
||||
props.toggleCollapse(props.id, !props.collapsedThread)
|
||||
|
@ -7,19 +7,9 @@ class ThreadList extends React.Component {
|
||||
super()
|
||||
this.state = { activeReplyId: null }
|
||||
this.toggleCollapse = this.toggleCollapse.bind(this)
|
||||
this.showCollapseLink = this.showCollapseLink.bind(this)
|
||||
this.showReply = this.showReply.bind(this)
|
||||
}
|
||||
|
||||
showCollapseLink(id, collapsed) {
|
||||
this.setState({ displayCollapse: 'block' })
|
||||
const otherComments = this.props.comments.filter(c => c.id !== id)
|
||||
const comment = this.props.comments.find(c => c.id === id)
|
||||
comment['displayCollapse'] = collapsed
|
||||
//console.log('displayed collapse for: ', comment)
|
||||
this.setState({ comments: otherComments.concat(comment) })
|
||||
}
|
||||
|
||||
toggleCollapse(id, collapsed) {
|
||||
const otherComments = this.props.comments.filter(c => c.id !== id)
|
||||
var parent = this.props.comments.find(c => c.id === id)
|
||||
@ -70,7 +60,6 @@ class ThreadList extends React.Component {
|
||||
<div className="ml-3" key={uuid()}>
|
||||
<SingleComment
|
||||
threadLevel={this.props.threadLevel}
|
||||
showCollapseLink={this.showCollapseLink}
|
||||
toggleCollapse={this.toggleCollapse}
|
||||
showReply={this.showReply}
|
||||
submitComment={this.props.submitComment}
|
||||
@ -80,7 +69,6 @@ class ThreadList extends React.Component {
|
||||
{comment.replies && (
|
||||
<ThreadList
|
||||
threadLevel={comment.id}
|
||||
showCollapseLink={this.showCollapseLink}
|
||||
comments={this.props.comments}
|
||||
submitComment={this.props.submitComment}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user