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

added sample settings page

This commit is contained in:
Fedor Katurov 2022-03-25 20:52:39 +07:00
parent 7a6a44cccf
commit 100c4c138a
29 changed files with 527 additions and 113 deletions

View file

@ -0,0 +1,55 @@
import React, { PropsWithChildren } from 'react';
import classNames from 'classnames';
import { Icon } from '~/components/input/Icon';
import { Placeholder } from '~/components/placeholders/Placeholder';
import { DivProps } from '~/utils/types';
import styles from './styles.module.scss';
interface HorizontalMenuProps extends DivProps {}
interface HorizontalMenuItemProps {
isLoading?: boolean;
icon?: string;
color?: 'green' | 'orange' | 'yellow';
active?: boolean;
onClick?: () => void;
}
function HorizontalMenu({ children, ...props }: HorizontalMenuProps) {
return (
<div {...props} className={classNames(styles.menu, props.className)}>
{children}
</div>
);
}
HorizontalMenu.Item = ({
icon,
color = 'green',
children,
isLoading,
active,
onClick,
}: PropsWithChildren<HorizontalMenuItemProps>) => {
if (isLoading) {
return (
<div className={styles.item} key="loading">
<Placeholder width="32px" height={32} />
<Placeholder width="96px" height={18} />
</div>
);
}
return (
<div
className={classNames(styles.item, { [styles.active]: active }, styles[color])}
onClick={onClick}
>
{!!icon && <Icon icon={icon} size={24} />}
<span className={styles.text}>{children}</span>
</div>
);
};
export { HorizontalMenu };