Comments block on the feed page

This commit is contained in:
Alexey Khaov 2023-01-27 00:42:47 +03:00
parent 25d62ace6c
commit 0606bbfa0b
4 changed files with 69 additions and 3 deletions

View File

@ -307,3 +307,19 @@
.isSubscribing {
opacity: 0.5;
}
.feedMode {
margin-bottom: 0.6rem;
.authorName {
@include font-size(1.2rem);
margin-bottom: 0;
}
.circlewrap {
height: 1.6rem;
margin-right: 0.4rem;
min-width: 1.6rem;
width: 1.6rem;
}
}

View File

@ -29,6 +29,7 @@ interface AuthorCardProps {
truncateBio?: boolean
liteButtons?: boolean
isComments?: boolean
isFeedMode?: boolean
}
export const AuthorCard = (props: AuthorCardProps) => {
@ -83,7 +84,8 @@ export const AuthorCard = (props: AuthorCardProps) => {
classList={{
[styles.authorPage]: props.isAuthorPage,
[styles.authorComments]: props.isComments,
[styles.authorsListItem]: props.isAuthorsList
[styles.authorsListItem]: props.isAuthorsList,
[styles.feedMode]: props.isFeedMode
}}
>
<Userpic

View File

@ -36,6 +36,7 @@
h4 {
@include font-size(2.2rem);
font-weight: bold;
margin-bottom: 2.4rem;
text-transform: lowercase;
}
}
@ -50,6 +51,7 @@
background: transparentize(#2638d9, 0.95);
display: inline-block;
font-weight: bold;
line-height: 1.2;
margin: 0 0.5em 0.5em 0;
padding: 0.6em 1em;
position: relative;
@ -96,3 +98,33 @@
border: none;
}
}
.comment {
@include font-size(1.5rem);
line-height: 1.4;
margin-bottom: 2.4rem;
&:last-child {
margin-bottom: 0;
}
p {
margin: 0;
}
}
.commentBody {
margin-bottom: 1.2rem;
line-clamp: 3;
-webkit-line-clamp: 3;
}
.commentArticleTitle {
@include font-size(1.2rem);
line-clamp: 1;
-webkit-line-clamp: 1;
}
.commentAuthor {
@include font-size(1.2rem);
}

View File

@ -18,6 +18,7 @@ import stylesArticle from '../../styles/Article.module.scss'
import stylesTopic from '../Feed/CardTopic.module.scss'
import styles from './Feed.module.scss'
import { clsx } from 'clsx'
import Userpic from '../Author/Userpic'
// const AUTHORSHIP_REACTIONS = [
// ReactionKind.Accept,
@ -132,8 +133,23 @@ export const FeedView = () => {
<section class={styles.asideSection}>
<h4>{t('Comments')}</h4>
<ul class={stylesArticle.comments}>
<For each={topComments()}>
{(comment) => <Comment comment={comment} reactions={[]} compact={true} />}
<For each={topComments().filter((item) => item.body)}>
{(comment) => {
return (
<li class={styles.comment}>
<div class={clsx('text-truncate', styles.commentBody)} innerHTML={comment.body} />
<AuthorCard
author={comment.createdBy}
isFeedMode={true}
compact={true}
hideFollow={true}
/>
<div class={clsx('text-truncate', styles.commentArticleTitle)}>
<a href={`/${comment.shout.slug}`}>{comment.shout.title}</a>
</div>
</li>
)
}}
</For>
</ul>
</section>