1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-30 15: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
src/components
boris/BorisUIDemo
node/NodeImageSwiperBlock
profile/ProfileAvatar

View file

@ -5,11 +5,14 @@ import markdown from '~/styles/common/markdown.module.scss';
import { Group } from '~/components/containers/Group';
import { Button } from '~/components/input/Button';
import { InputText } from '~/components/input/InputText';
import { useShowModal } from '~/hooks/modal/useShowModal';
import { Dialog } from '~/constants/modal';
interface IProps {}
const BorisUIDemo: FC<IProps> = () => {
const [text, setText] = useState('');
const openProfileSidebar = useShowModal(Dialog.ProfileSidebar);
return (
<Card className={styles.card}>
@ -20,6 +23,9 @@ const BorisUIDemo: FC<IProps> = () => {
разработке
</p>
<h2>Тестовые фичи</h2>
<Button onClick={() => openProfileSidebar({})}>Профиль в сайдбаре</Button>
<h2>Инпуты</h2>
<form autoComplete="off">

View file

@ -25,6 +25,8 @@
:global(.swiper-button-next),
:global(.swiper-button-prev) {
@include outer_shadow;
color: white;
font-size: 10px;
width: 40px;

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;