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