Highlight comment author when it's the post author

This commit is contained in:
Christopher Gurnee 2021-12-12 16:19:29 -05:00
parent c6eaa3a865
commit e98baf062a
5 changed files with 12 additions and 3 deletions

2
dist/main.css vendored

File diff suppressed because one or more lines are too long

View file

@ -46,7 +46,7 @@ const Comment = (props) => {
<span className='space' />
<a
href={props.author !== '[deleted]' ? `https://www.reddit.com/user/${props.author}` : undefined}
className='author comment-author'
className={props.author == props.postAuthor ? 'author comment-author comment-poster' : 'author comment-author'}
>
{props.author}
{props.deleted && ' (deleted by user)'}
@ -76,6 +76,7 @@ const Comment = (props) => {
key={comment.id}
{...comment}
depth={props.depth + 1}
postAuthor={props.postAuthor}
/>
))}
</div>

View file

@ -99,6 +99,7 @@ const commentSection = (props) => {
key={comment.id}
{...comment}
depth={0}
postAuthor={props.postAuthor}
/>
))
: <p>No comments found</p>

View file

@ -141,7 +141,7 @@ class Thread extends React.Component {
}
render () {
const { subreddit, id } = this.state.post
const { subreddit, id, author } = this.state.post
const { commentID } = this.props.match.params
const linkToRestOfComments = `/r/${subreddit}/comments/${id}/_/`
@ -171,6 +171,7 @@ class Thread extends React.Component {
comments={this.state.pushshiftCommentLookup}
removed={this.state.removed}
deleted={this.state.deleted}
postAuthor={author}
/>
</React.Fragment>
}

View file

@ -23,6 +23,12 @@
.comment-author:not([href])
color: #828282
.comment-poster
color: $light
background-color: #0055df
padding: 0 2px
border-radius: 3px
.comment-score
color: #b4b4b4
font-weight: bold