From 142748f81e3172419568f8f19f13d98f9442f8d5 Mon Sep 17 00:00:00 2001 From: kvakazyambra Date: Thu, 18 May 2023 00:10:15 +0300 Subject: [PATCH] Add link to the article in comments on the author page --- src/components/Article/Comment.module.scss | 38 ++++++++++++++++--- src/components/Article/Comment.tsx | 20 +++++++++- .../Views/Author/Author.module.scss | 4 ++ src/components/Views/Author/Author.tsx | 12 ++++-- 4 files changed, 64 insertions(+), 10 deletions(-) diff --git a/src/components/Article/Comment.module.scss b/src/components/Article/Comment.module.scss index fd2f137b..5f5c2fe3 100644 --- a/src/components/Article/Comment.module.scss +++ b/src/components/Article/Comment.module.scss @@ -169,6 +169,32 @@ margin-right: 12px; } +.articleLink { + flex: 0 0 50%; + @include font-size(1.2rem); + margin-right: 2em; + + @include media-breakpoint-down(md) { + margin: 0.3em 0 0.5em; + } + + @include media-breakpoint-up(md) { + line-clamp: 1; + -webkit-line-clamp: 1; + -webkit-box-orient: vertical; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + } +} + +.articleLinkIcon { + display: inline-block; + margin-right: 1em; + vertical-align: middle; + width: 1em; +} + .commentDates { flex: 1; display: flex; @@ -176,7 +202,7 @@ align-items: center; justify-content: flex-start; font-size: 1.2rem; - margin-bottom: 4px; + margin: 0 1em 4px 0; color: rgb(0 0 0 / 30%); @include font-size(1.2rem); @@ -190,17 +216,17 @@ margin-right: 0.5rem; vertical-align: middle; } - - @include media-breakpoint-down(md) { - margin-left: 1rem; - } } } .commentDetails { - display: flex; padding: 1rem 0.2rem 0; margin-bottom: 1.2rem; + + @include media-breakpoint-up(md) { + align-items: start; + display: flex; + } } .compactUserpic { diff --git a/src/components/Article/Comment.tsx b/src/components/Article/Comment.tsx index a412dc49..d6a17b80 100644 --- a/src/components/Article/Comment.tsx +++ b/src/components/Article/Comment.tsx @@ -14,6 +14,8 @@ import { useSnackbar } from '../../context/snackbar' import { ShowIfAuthenticated } from '../_shared/ShowIfAuthenticated' import { useLocalize } from '../../context/localize' import { CommentRatingControl } from './CommentRatingControl' +import { getPagePath } from '@nanostores/router' +import { router } from '../../stores/router' const CommentEditor = lazy(() => import('../_shared/CommentEditor')) @@ -23,6 +25,8 @@ type Props = { isArticleAuthor?: boolean sortedComments?: Reaction[] lastSeen?: Date + class?: string + showArticleLink?: boolean } export const Comment = (props: Props) => { @@ -98,7 +102,11 @@ export const Comment = (props: Props) => { const createdAt = new Date(comment()?.createdAt) return ( -
  • props.lastSeen })}> +
  • props.lastSeen + })} + >
    {
    {t('Author')}
    + + + +
    {formattedDate(comment()?.createdAt)()}
    @@ -142,6 +159,7 @@ export const Comment = (props: Props) => {
    +
    diff --git a/src/components/Views/Author/Author.module.scss b/src/components/Views/Author/Author.module.scss index 01264b2a..5098043d 100644 --- a/src/components/Views/Author/Author.module.scss +++ b/src/components/Views/Author/Author.module.scss @@ -87,3 +87,7 @@ .authorContainer { margin-top: 3.2rem; } + +.comment { + background: #efefef; +} diff --git a/src/components/Views/Author/Author.tsx b/src/components/Views/Author/Author.tsx index f67ee3d6..3a927fec 100644 --- a/src/components/Views/Author/Author.tsx +++ b/src/components/Views/Author/Author.tsx @@ -223,9 +223,15 @@ export const AuthorView = (props: AuthorProps) => {
    -
      - {(comment) => } -
    +
    +
    +
      + + {(comment) => } + +
    +
    +