mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
added sample data to profile sidebar
This commit is contained in:
parent
0c9d5467ed
commit
367ba0cc4d
4 changed files with 101 additions and 19 deletions
|
@ -1,26 +1,29 @@
|
||||||
import React, { forwardRef, ForwardRefRenderFunction, VFC } from 'react';
|
import React, { forwardRef } from 'react';
|
||||||
import styles from './styles.module.scss';
|
import styles from './styles.module.scss';
|
||||||
import { DivProps } from '~/utils/types';
|
import { DivProps } from '~/utils/types';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
interface SquareProps extends DivProps {
|
interface SquareProps extends DivProps {
|
||||||
image: string;
|
image?: string;
|
||||||
size?: number;
|
size?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Square = forwardRef<HTMLDivElement, SquareProps>(({ image, size, ...rest }, ref) => {
|
const Square = forwardRef<HTMLDivElement, SquareProps>(
|
||||||
const backgroundImage = image ? `url('${image}')` : undefined;
|
({ image, size, children, ...rest }, ref) => {
|
||||||
|
const backgroundImage = image ? `url('${image}')` : undefined;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
{...rest}
|
{...rest}
|
||||||
className={classNames(styles.wrapper, rest.className)}
|
className={classNames(styles.wrapper, rest.className)}
|
||||||
style={{ backgroundImage, width: size }}
|
style={{ backgroundImage, width: size }}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
>
|
>
|
||||||
<svg className={styles.svg} viewBox="0 0 1 1" />
|
<svg className={styles.svg} viewBox="0 0 1 1" />
|
||||||
</div>
|
{!!children && <div className={styles.content}>{children}</div>}
|
||||||
);
|
</div>
|
||||||
});
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export { Square };
|
export { Square };
|
||||||
|
|
|
@ -9,4 +9,13 @@
|
||||||
border-radius: $radius;
|
border-radius: $radius;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,18 @@ import { Button } from '~/components/input/Button';
|
||||||
import { Filler } from '~/components/containers/Filler';
|
import { Filler } from '~/components/containers/Filler';
|
||||||
import { ProfileSidebarHead } from '~/containers/profile/ProfileSidebarHead';
|
import { ProfileSidebarHead } from '~/containers/profile/ProfileSidebarHead';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
import { Group } from '~/components/containers/Group';
|
||||||
|
import { Card } from '~/components/containers/Card';
|
||||||
|
import { Grid } from '~/components/containers/Grid';
|
||||||
|
import { Square } from '~/components/common/Square';
|
||||||
|
import { Padder } from '~/components/containers/Padder';
|
||||||
|
import { useUser } from '~/hooks/auth/useUser';
|
||||||
|
|
||||||
interface ProfileSidebarProps extends DialogComponentProps {}
|
interface ProfileSidebarProps extends DialogComponentProps {}
|
||||||
|
|
||||||
const ProfileSidebar: VFC<ProfileSidebarProps> = ({ onRequestClose }) => {
|
const ProfileSidebar: VFC<ProfileSidebarProps> = ({ onRequestClose }) => {
|
||||||
|
const { user } = useUser();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SidebarWrapper onClose={onRequestClose}>
|
<SidebarWrapper onClose={onRequestClose}>
|
||||||
<div className={styles.wrap}>
|
<div className={styles.wrap}>
|
||||||
|
@ -20,11 +28,41 @@ const ProfileSidebar: VFC<ProfileSidebarProps> = ({ onRequestClose }) => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Filler className={classNames(markdown.wrapper, styles.text)}>
|
<Filler className={classNames(markdown.wrapper, styles.text)}>
|
||||||
<h3>Здесь будет профиль</h3>
|
<Group>
|
||||||
|
<ul className={styles.menu}>
|
||||||
|
<li>Настройки</li>
|
||||||
|
<li>Заметки</li>
|
||||||
|
<li>Удалённые посты</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<p>
|
<Grid columns="2fr 1fr">
|
||||||
Но пока что мы просто тестируем как это будет выглядеть и будет ли это удобнее модалки
|
<Card>
|
||||||
</p>
|
<h4>1 год 2 месяца</h4>
|
||||||
|
<small>в убежище</small>
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
<Card>
|
||||||
|
<Square>
|
||||||
|
<h4>24 поста</h4>
|
||||||
|
<small>Создано</small>
|
||||||
|
</Square>
|
||||||
|
</Card>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid columns="1fr 2fr">
|
||||||
|
<Card>
|
||||||
|
<Square>
|
||||||
|
<h4>16545 лайка</h4>
|
||||||
|
<small>получено</small>
|
||||||
|
</Square>
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
<Card>
|
||||||
|
<h4>123123 комментария</h4>
|
||||||
|
<small>под постами</small>
|
||||||
|
</Card>
|
||||||
|
</Grid>
|
||||||
|
</Group>
|
||||||
</Filler>
|
</Filler>
|
||||||
|
|
||||||
<Button round onClick={onRequestClose} color="secondary">
|
<Button round onClick={onRequestClose} color="secondary">
|
||||||
|
|
|
@ -20,3 +20,35 @@
|
||||||
.text {
|
.text {
|
||||||
margin-top: $gap * 2;
|
margin-top: $gap * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.menu {
|
||||||
|
@include outer_shadow;
|
||||||
|
|
||||||
|
list-style: none;
|
||||||
|
border-radius: $radius;
|
||||||
|
padding: 0 !important;
|
||||||
|
|
||||||
|
& > li {
|
||||||
|
@include row_shadow;
|
||||||
|
|
||||||
|
list-style: none;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: $gap;
|
||||||
|
font: $font_16_semibold;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: transparentize($secondary, 1);
|
||||||
|
transition: background-color 0.25s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: transparentize($secondary, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
border-radius: $radius $radius 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-radius: 0 0 $radius $radius;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue