1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00
vault-frontend/src/components/containers/CommentWrapper/index.tsx
muerwre e071409241
highlight and scroll to new comments if authorized (#76)
* added new drone file

* commented-out unnecessary build stages

* commented-out unnecessary build stages

* added dynamic repo

* added dynamic repo

* added registry global env

* added registry global env

* added registry global env

* added template

* added template

* added template

* added template

* added branches to template

* added branches to template

* made build based on template

* made build based on template

* changed env file

* added .env.development file to repo

* fixed branch to develop

* added variables for develop and master

* added variables for develop and master

* added env variables to builder

* added env variables to builder

* added env variables to builder

* changed drone.yml

* added highlight for new comments

* fixed dependencies for useScrollToTop

* added smooth scrolling for comments

* fixed new comments highlight for same user
2021-10-06 12:48:26 +07:00

45 lines
1 KiB
TypeScript

import React, { FC } from 'react';
import classNames from 'classnames';
import styles from './styles.module.scss';
import { IUser } from '~/redux/auth/types';
import { path } from 'ramda';
import { CommentAvatar } from '~/components/comment/CommentAvatar';
import { DivProps } from '~/utils/types';
type IProps = DivProps & {
user: IUser;
isEmpty?: boolean;
isLoading?: boolean;
isForm?: boolean;
isNew?: boolean;
};
const CommentWrapper: FC<IProps> = ({
user,
className,
isEmpty,
isLoading,
isForm,
children,
isNew,
...props
}) => (
<div
className={classNames(styles.wrap, className, {
[styles.is_empty]: isEmpty,
[styles.is_loading]: isLoading,
[styles.is_new]: isNew,
})}
{...props}
>
<div className={styles.thumb}>
<CommentAvatar user={user} className={styles.thumb_image} withDetails={!isForm} />
<div className={styles.thumb_user}>~{path(['username'], user)}</div>
</div>
<div className={styles.text}>{children}</div>
</div>
);
export { CommentWrapper };