1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46: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,28 @@
import React, { FC, useCallback } from 'react';
import { getURLFromString } from '~/utils/dom';
import { PRESETS } from '~/constants/urls';
import styles from './styles.module.scss';
import classNames from 'classnames';
import { openUserProfile } from '~/utils/user';
interface Props {
url?: string;
username?: string;
size?: number;
className?: string;
}
const CommentAvatar: FC<Props> = ({ url, username, size, className }) => {
const backgroundImage = !!url ? `url('${getURLFromString(url, PRESETS.avatar)}')` : undefined;
const onOpenProfile = useCallback(() => openUserProfile(username), [username]);
return (
<div
className={classNames(styles.avatar, className)}
style={{ backgroundImage }}
onClick={onOpenProfile}
/>
);
};
export { CommentAvatar };