1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-26 05:16:41 +07:00
vault-frontend/src/components/lab/LabHeadItem/index.tsx
2021-03-22 17:46:47 +07:00

32 lines
888 B
TypeScript

import React, { FC } from 'react';
import { Group } from '~/components/containers/Group';
import { Icon } from '~/components/input/Icon';
import { Placeholder } from '~/components/placeholders/Placeholder';
import styles from './styles.module.scss';
import classNames from 'classnames';
interface IProps {
icon: string;
isLoading?: boolean;
active?: boolean;
}
const LabHeadItem: FC<IProps> = ({ icon, children, isLoading, active }) => {
if (isLoading) {
return (
<Group horizontal className={styles.item}>
<Placeholder width="32px" height={32} />
<Placeholder width="96px" height={18} />
</Group>
);
}
return (
<Group horizontal className={classNames(styles.item, { [styles.active]: active })}>
<Icon icon={icon} size={24} />
<span className={styles.text}>{children}</span>
</Group>
);
};
export { LabHeadItem };