1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00

added sidebar headers

This commit is contained in:
Fedor Katurov 2022-01-14 17:02:25 +07:00
parent 01fac15a00
commit 2e75e4f7c0
6 changed files with 61 additions and 7 deletions

View file

@ -1,7 +1,6 @@
@import "src/styles/variables";
.wrap {
@include sidebar_content(600px);
display: flex;
align-items: center;
justify-content: center;

View file

@ -1,5 +1,7 @@
import React, { FC, useMemo } from 'react';
import styles from './styles.module.scss';
import { Button } from '~/components/input/Button';
import { Filler } from '~/components/containers/Filler';
interface SidebarStackProps {}

View file

@ -9,11 +9,10 @@
}
.card {
@include sidebar_content(400px);
box-shadow: transparentize(white, 0.9) -1px 0;
max-width: 400px;
width: 100vw;
border-radius: $radius 0 0 $radius;
display: flex;
flex-direction: column;
}
.content {

View file

@ -0,0 +1,31 @@
import React, { FC, useMemo } from 'react';
import styles from './styles.module.scss';
import { Filler } from '~/components/containers/Filler';
import { Button } from '~/components/input/Button';
interface SidebarStackCardProps {
width?: number;
headerFeature?: 'back' | 'close';
title?: string;
}
const SidebarStackCard: FC<SidebarStackCardProps> = ({ children, title, width, headerFeature }) => {
const style = useMemo(() => ({ maxWidth: width, flexBasis: width }), [width]);
return (
<div style={style} className={styles.card}>
{(headerFeature || title) && (
<div className={styles.head}>
<Filler>{!!title && <h5>{title}</h5>}</Filler>
{headerFeature === 'back' && <Button color="link" iconRight="right" />}
{headerFeature === 'close' && <Button color="link" iconRight="close" />}
</div>
)}
<Filler>{children}</Filler>
</div>
);
};
export { SidebarStackCard };

View file

@ -0,0 +1,17 @@
@import "src/styles/variables";
.card {
width: 100vw;
max-width: 400px;
flex-basis: 400px;
flex: 1;
}
.head {
@include row_shadow;
display: flex;
flex-direction: row;
align-items: center;
padding: $gap $gap $gap $gap * 2;
}

View file

@ -4,6 +4,7 @@ import { DialogComponentProps } from '~/types/modal';
import { ProfileSidebarMenu } from '~/containers/profile/ProfileSidebarMenu';
import { SidebarStack } from '~/components/sidebar/SidebarStack';
import { ProfileSidebarSettings } from '~/components/profile/ProfileSidebarSettings';
import { SidebarStackCard } from '~/components/sidebar/SidebarStackCard';
interface ProfileSidebarProps extends DialogComponentProps {}
@ -11,8 +12,13 @@ const ProfileSidebar: VFC<ProfileSidebarProps> = ({ onRequestClose }) => {
return (
<SidebarWrapper onClose={onRequestClose}>
<SidebarStack>
<ProfileSidebarMenu onClose={onRequestClose} />
<ProfileSidebarSettings />
<SidebarStackCard headerFeature="close" title="Профиль">
<ProfileSidebarMenu onClose={onRequestClose} />
</SidebarStackCard>
<SidebarStackCard width={600} headerFeature="back" title="Настройки">
<ProfileSidebarSettings />
</SidebarStackCard>
</SidebarStack>
</SidebarWrapper>
);