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:
parent
c1279c538a
commit
f2fbca80e1
21 changed files with 209 additions and 55 deletions
32
src/components/node/NodeAuthorBlock/index.tsx
Normal file
32
src/components/node/NodeAuthorBlock/index.tsx
Normal 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 };
|
Loading…
Add table
Add a link
Reference in a new issue