mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
fixed comments appearance
This commit is contained in:
parent
c84dfdd2ab
commit
fe90fc16ac
4 changed files with 51 additions and 8 deletions
|
@ -3,21 +3,26 @@ import classNames from 'classnames';
|
||||||
|
|
||||||
import * as styles from './styles.scss';
|
import * as styles from './styles.scss';
|
||||||
import { Card } from '../Card';
|
import { Card } from '../Card';
|
||||||
|
import { IUser } from '~/redux/auth/types';
|
||||||
|
import { getURL } from '~/utils/dom';
|
||||||
|
import path from 'ramda/es/path';
|
||||||
|
|
||||||
type IProps = HTMLAttributes<HTMLDivElement> & {
|
type IProps = HTMLAttributes<HTMLDivElement> & {
|
||||||
photo?: string;
|
// photo?: string;
|
||||||
|
user: IUser;
|
||||||
is_empty?: boolean;
|
is_empty?: boolean;
|
||||||
is_loading?: boolean;
|
is_loading?: boolean;
|
||||||
is_same?: boolean;
|
is_same?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const CommentWrapper: FC<IProps> = ({
|
const CommentWrapper: FC<IProps> = ({
|
||||||
photo,
|
// photo,
|
||||||
children,
|
children,
|
||||||
is_empty,
|
is_empty,
|
||||||
is_loading,
|
is_loading,
|
||||||
className,
|
className,
|
||||||
is_same,
|
is_same,
|
||||||
|
user,
|
||||||
...props
|
...props
|
||||||
}) => (
|
}) => (
|
||||||
<Card
|
<Card
|
||||||
|
@ -26,9 +31,11 @@ const CommentWrapper: FC<IProps> = ({
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<div className={styles.thumb}>
|
<div className={styles.thumb}>
|
||||||
{!is_same && photo && (
|
<div
|
||||||
<div className={styles.thumb_image} style={{ backgroundImage: `url("${photo}")` }} />
|
className={styles.thumb_image}
|
||||||
)}
|
style={{ backgroundImage: `url("${getURL(path(['photo'], user))}")` }}
|
||||||
|
/>
|
||||||
|
<div className={styles.thumb_user}>~{path(['username'], user)}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.text}>{children}</div>
|
<div className={styles.text}>{children}</div>
|
||||||
|
|
|
@ -14,6 +14,10 @@
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@include tablet {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
|
@ -25,6 +29,17 @@
|
||||||
flex: 0 0 $comment_height;
|
flex: 0 0 $comment_height;
|
||||||
border-radius: $panel_radius 0 0 $panel_radius;
|
border-radius: $panel_radius 0 0 $panel_radius;
|
||||||
background-color: transparentize(black, 0.9);
|
background-color: transparentize(black, 0.9);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
@include tablet {
|
||||||
|
flex-direction: row;
|
||||||
|
flex: 0 0 40px;
|
||||||
|
padding: 8px;
|
||||||
|
box-shadow: inset rgba(255, 255, 255, 0.05) 1px 1px, inset rgba(0, 0, 0, 0.1) -1px -1px;
|
||||||
|
border-radius: $panel_radius $panel_radius 0 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumb_image {
|
.thumb_image {
|
||||||
|
@ -32,4 +47,25 @@
|
||||||
background: transparentize(white, 0.97) no-repeat 50% 50%;
|
background: transparentize(white, 0.97) no-repeat 50% 50%;
|
||||||
border-radius: $panel_radius 0 0 $panel_radius;
|
border-radius: $panel_radius 0 0 $panel_radius;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
|
flex: 0 0 $comment_height;
|
||||||
|
|
||||||
|
@include tablet {
|
||||||
|
height: 32px;
|
||||||
|
flex: 0 0 32px;
|
||||||
|
border-radius: $panel_radius;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.thumb_user {
|
||||||
|
display: none;
|
||||||
|
flex: 1;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 0 $gap;
|
||||||
|
font: $font_14_medium;
|
||||||
|
|
||||||
|
@include tablet {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ const Comment: FC<IProps> = ({
|
||||||
className={className}
|
className={className}
|
||||||
is_empty={is_empty}
|
is_empty={is_empty}
|
||||||
is_loading={is_loading}
|
is_loading={is_loading}
|
||||||
photo={getURL(comment_group.user.photo)}
|
user={comment_group.user}
|
||||||
is_same={is_same}
|
is_same={is_same}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
|
|
|
@ -42,7 +42,7 @@ type IProps = ReturnType<typeof mapStateToProps> &
|
||||||
const CommentFormUnconnected: FC<IProps> = ({
|
const CommentFormUnconnected: FC<IProps> = ({
|
||||||
node: { comment_data, is_sending_comment },
|
node: { comment_data, is_sending_comment },
|
||||||
uploads: { statuses, files },
|
uploads: { statuses, files },
|
||||||
user: { photo },
|
user,
|
||||||
id,
|
id,
|
||||||
nodePostComment,
|
nodePostComment,
|
||||||
nodeSetCommentData,
|
nodeSetCommentData,
|
||||||
|
@ -122,7 +122,7 @@ const CommentFormUnconnected: FC<IProps> = ({
|
||||||
const comment = comment_data[id];
|
const comment = comment_data[id];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CommentWrapper photo={getURL(photo)}>
|
<CommentWrapper user={user}>
|
||||||
<form onSubmit={onSubmit} className={styles.wrap}>
|
<form onSubmit={onSubmit} className={styles.wrap}>
|
||||||
<div className={styles.input}>
|
<div className={styles.input}>
|
||||||
<Textarea
|
<Textarea
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue