1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46: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

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