improves comment display
adds channel link adds support for newline better handles long channel names
This commit is contained in:
parent
7a687cac39
commit
062899c483
3 changed files with 35 additions and 6 deletions
|
@ -1,25 +1,28 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import relativeDate from 'tiny-relative-date';
|
import relativeDate from 'tiny-relative-date';
|
||||||
|
import Button from '../button';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
author: string,
|
author: string,
|
||||||
|
authorUri: string,
|
||||||
message: string,
|
message: string,
|
||||||
timePosted: number,
|
timePosted: number,
|
||||||
};
|
};
|
||||||
|
|
||||||
function Comment(props: Props) {
|
function Comment(props: Props) {
|
||||||
const { author, timePosted, message } = props;
|
const { author, authorUri, timePosted, message } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li className="comment">
|
<li className="comment">
|
||||||
<div className="comment__meta card__actions--between">
|
<div className="comment__meta">
|
||||||
<strong>{author || __('Anonymous')}</strong>
|
<Button className="button--uri-indicator truncated-text comment__author" navigate={authorUri} label={author} />
|
||||||
|
<time className="comment__time" dateTime={timePosted}>
|
||||||
<time dateTime={timePosted}>{relativeDate(timePosted)}</time>
|
{relativeDate(timePosted)}
|
||||||
|
</time>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>{message}</p>
|
<p className={'comment__message'}>{message}</p>
|
||||||
{/* The following is for adding threaded replies, upvoting and downvoting */}
|
{/* The following is for adding threaded replies, upvoting and downvoting */}
|
||||||
{/* <div className="comment__actions card__actions--between"> */}
|
{/* <div className="comment__actions card__actions--between"> */}
|
||||||
{/* <button className={'button button--primary'}>Reply</button> */}
|
{/* <button className={'button button--primary'}>Reply</button> */}
|
||||||
|
|
|
@ -21,6 +21,7 @@ function CommentList(props: Props) {
|
||||||
comments.map(comment => {
|
comments.map(comment => {
|
||||||
return (
|
return (
|
||||||
<Comment
|
<Comment
|
||||||
|
authorUri={comment.channel_url}
|
||||||
author={comment.channel_name}
|
author={comment.channel_name}
|
||||||
claimId={comment.channel_id}
|
claimId={comment.channel_id}
|
||||||
commentId={comment.comment_id}
|
commentId={comment.comment_id}
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
border-color: rgba($lbry-gray-5, 0.2);
|
border-color: rgba($lbry-gray-5, 0.2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// .comment__actions-wrap {
|
// .comment__actions-wrap {
|
||||||
|
@ -52,4 +55,26 @@
|
||||||
time {
|
time {
|
||||||
opacity: 0.3;
|
opacity: 0.3;
|
||||||
}
|
}
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment__message {
|
||||||
|
white-space: pre-line;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment__author {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
text-overflow: ellipsis; // This is where the magic happens
|
||||||
|
flex-basis: 400px;
|
||||||
|
flex-shrink: 1;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment__time {
|
||||||
|
flex-basis: 200px;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue