2020-01-17 23:37:52 +03:00
|
|
|
import React, { ComponentType } from 'react';
|
2019-12-07 21:43:08 +02:00
|
|
|
import clsx from 'clsx';
|
2020-01-17 23:37:52 +03:00
|
|
|
|
2019-12-07 21:02:00 +02:00
|
|
|
import { Skin } from 'app/components/ui';
|
2016-08-14 11:58:14 +03:00
|
|
|
|
|
|
|
import styles from './componentLoader.scss';
|
|
|
|
|
2019-12-30 10:15:40 +02:00
|
|
|
// TODO: add mode to not show loader until first ~150ms
|
|
|
|
|
2020-01-17 23:37:52 +03:00
|
|
|
interface Props {
|
2020-05-24 02:08:24 +03:00
|
|
|
skin?: Skin;
|
2020-10-23 01:23:59 +03:00
|
|
|
className?: string;
|
2016-08-14 11:58:14 +03:00
|
|
|
}
|
|
|
|
|
2020-10-23 01:23:59 +03:00
|
|
|
const ComponentLoader: ComponentType<Props> = ({ skin = 'dark', className }) => (
|
|
|
|
<div className={clsx(styles.componentLoader, styles[`${skin}ComponentLoader`], className)}>
|
2020-05-24 02:08:24 +03:00
|
|
|
<div className={styles.spins}>
|
|
|
|
{new Array(5).fill(0).map((_, index) => (
|
|
|
|
<div className={clsx(styles.spin, styles[`spin${index}`])} key={index} />
|
|
|
|
))}
|
|
|
|
</div>
|
2020-01-17 23:37:52 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
2019-12-07 13:28:52 +02:00
|
|
|
export default ComponentLoader;
|