Uses Expandable
only if the message exceeds 300 characters
This commit is contained in:
parent
23ec4beb7c
commit
26ae67702d
2 changed files with 8 additions and 6 deletions
|
@ -19,6 +19,8 @@ type Props = {
|
|||
channelIsBlocked: boolean,
|
||||
};
|
||||
|
||||
const LENGTH_TO_COLLAPSE = 300;
|
||||
|
||||
function Comment(props: Props) {
|
||||
const {
|
||||
author,
|
||||
|
@ -40,7 +42,6 @@ function Comment(props: Props) {
|
|||
resolveUri(authorUri);
|
||||
}
|
||||
}, [isResolvingUri, shouldFetch, author, authorUri, resolveUri]);
|
||||
|
||||
return (
|
||||
<li className="comment">
|
||||
<div className="comment__author-thumbnail">
|
||||
|
@ -59,11 +60,13 @@ function Comment(props: Props) {
|
|||
</time>
|
||||
</span>
|
||||
<div>
|
||||
<Expandable>
|
||||
<div className="comment__message">
|
||||
{message.length >= LENGTH_TO_COLLAPSE ? (
|
||||
<Expandable className="comment__message">
|
||||
<MarkdownPreview content={message} promptLinks />
|
||||
</div>
|
||||
</Expandable>
|
||||
</Expandable>
|
||||
) : (
|
||||
<MarkdownPreview content={message} promptLinks />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
|
|
@ -10,7 +10,6 @@ type Props = {
|
|||
|
||||
function CommentList(props: Props) {
|
||||
const { fetchComments, uri, comments } = props;
|
||||
|
||||
useEffect(() => {
|
||||
fetchComments(uri);
|
||||
}, [fetchComments, uri]);
|
||||
|
|
Loading…
Add table
Reference in a new issue