1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-29 14:46:41 +07:00

added placeholders

This commit is contained in:
Fedor Katurov 2021-04-21 12:58:44 +07:00
parent 44ab426915
commit b4b138e90f
16 changed files with 239 additions and 117 deletions

View file

@ -1,14 +1,31 @@
import React, { FC } from 'react';
import styles from './styles.module.scss';
import classNames from 'classnames';
interface IProps {
export interface PlaceholderProps {
width?: string;
height?: number;
color?: string;
active?: boolean;
loading?: boolean;
}
const Placeholder: FC<IProps> = ({ width = '120px', height, color }) => (
<div className={styles.placeholder} style={{ height, color, width }} />
);
const Placeholder: FC<PlaceholderProps> = ({
width = '120px',
height,
color,
active,
children,
loading = true,
}) => {
return active ? (
<div
className={classNames(styles.placeholder, { [styles.loading]: loading })}
style={{ height, color, width }}
/>
) : (
<>{children}</>
);
};
export { Placeholder };