mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
added empty profile sidebar
This commit is contained in:
parent
7f7c12df2b
commit
0c9d5467ed
12 changed files with 138 additions and 43 deletions
|
@ -2,17 +2,17 @@ import React, { ChangeEvent, FC, useCallback } from 'react';
|
|||
import styles from './styles.module.scss';
|
||||
import { getURL } from '~/utils/dom';
|
||||
import { PRESETS } from '~/constants/urls';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import { IFile } from '~/types';
|
||||
import { Button } from '~/components/input/Button';
|
||||
|
||||
export interface ProfileAvatarProps {
|
||||
size?: number;
|
||||
canEdit: boolean;
|
||||
photo?: IFile;
|
||||
onChangePhoto: (file: File) => void;
|
||||
}
|
||||
|
||||
const ProfileAvatar: FC<ProfileAvatarProps> = ({ photo, onChangePhoto, canEdit }) => {
|
||||
const ProfileAvatar: FC<ProfileAvatarProps> = ({ photo, onChangePhoto, canEdit, size }) => {
|
||||
const onInputChange = useCallback(
|
||||
async (event: ChangeEvent<HTMLInputElement>) => {
|
||||
if (!event.target.files?.length) {
|
||||
|
@ -31,6 +31,8 @@ const ProfileAvatar: FC<ProfileAvatarProps> = ({ photo, onChangePhoto, canEdit }
|
|||
className={styles.avatar}
|
||||
style={{
|
||||
backgroundImage,
|
||||
width: size,
|
||||
height: size,
|
||||
}}
|
||||
>
|
||||
{canEdit && <input type="file" onInput={onInputChange} />}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue