1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-26 21:36:40 +07:00

fixed shadows, added author panel

This commit is contained in:
Fedor Katurov 2021-09-22 14:18:09 +07:00
parent c1279c538a
commit f2fbca80e1
21 changed files with 209 additions and 55 deletions

View file

@ -0,0 +1,32 @@
import React, { FC, useCallback } from 'react';
import { INode } from '~/redux/types';
import styles from './styles.module.scss';
import { CommentAvatar } from '~/components/comment/CommentAvatar';
import { openUserProfile } from '~/utils/user';
interface Props {
node?: INode;
}
const NodeAuthorBlock: FC<Props> = ({ node }) => {
if (!node?.user) {
return null;
}
const { fullname, username, description, photo } = node.user;
const onOpenProfile = useCallback(() => openUserProfile(username), [username]);
return (
<div className={styles.block} onClick={onOpenProfile}>
<CommentAvatar username={username} url={photo?.url} className={styles.avatar} />
<div className={styles.info}>
<div className={styles.username}>{fullname || username}</div>
{description && <div className={styles.description}>{description}</div>}
</div>
</div>
);
};
export { NodeAuthorBlock };