1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-26 05:16:41 +07:00

added empty profile sidebar

This commit is contained in:
Fedor Katurov 2022-01-11 16:34:26 +07:00
parent 7f7c12df2b
commit 0c9d5467ed
12 changed files with 138 additions and 43 deletions

View file

@ -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} />}

View file

@ -8,10 +8,8 @@
height: 100px;
background: $content_bg 50% 50% no-repeat;
background-size: cover;
position: absolute;
bottom: 0;
left: $gap;
cursor: pointer;
position: relative;
input {
position: absolute;