1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

formatting comment text

This commit is contained in:
muerwre 2019-08-27 21:49:20 +07:00
parent 1990783fa3
commit 59993f5beb
5 changed files with 27 additions and 4 deletions

View file

@ -2,6 +2,8 @@ import React, { FC, HTMLAttributes } from 'react';
import { CommentWrapper } from '~/components/containers/CommentWrapper';
import { IComment } from '~/redux/types';
import * as styles from './styles.scss';
import { formatCommentText } from '~/utils/dom';
import { Group } from '~/components/containers/Group';
type IProps = HTMLAttributes<HTMLDivElement> & {
is_empty?: boolean;
@ -12,7 +14,14 @@ type IProps = HTMLAttributes<HTMLDivElement> & {
const Comment: FC<IProps> = ({ comment, is_empty, is_loading, className, photo, ...props }) => (
<CommentWrapper is_empty={is_empty} is_loading={is_loading} photo={photo} {...props}>
{comment.text && <div className={styles.text}>{comment.text}</div>}
{comment.text && (
<Group
className={styles.text}
dangerouslySetInnerHTML={{
__html: formatCommentText(comment.user && comment.user.username, comment.text),
}}
/>
)}
</CommentWrapper>
);

View file

@ -1,3 +1,8 @@
.text {
padding: $gap / 2;
font-weight: 300;
b {
font-weight: 600;
}
}