mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-26 05:16:41 +07:00
35 lines
646 B
TypeScript
35 lines
646 B
TypeScript
import React, { FC } from 'react';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
import styles from './styles.module.scss';
|
|
|
|
export interface PlaceholderProps {
|
|
width?: string;
|
|
height?: number;
|
|
color?: string;
|
|
active?: boolean;
|
|
loading?: boolean;
|
|
className?: string;
|
|
}
|
|
|
|
const Placeholder: FC<PlaceholderProps> = ({
|
|
width = '120px',
|
|
height,
|
|
color,
|
|
active,
|
|
children,
|
|
loading = true,
|
|
className,
|
|
}) => {
|
|
return active ? (
|
|
<div
|
|
className={classNames(styles.placeholder, { [styles.loading]: loading }, className)}
|
|
style={{ height, color, width }}
|
|
/>
|
|
) : (
|
|
<>{children}</>
|
|
);
|
|
};
|
|
|
|
export { Placeholder };
|