aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ui/loader/index.tsx
blob: 0607bd48b41a99b0c4e1fe6ab0b09849ec859841 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import classnames from 'classnames';
import { Component } from 'react';
import injectStyle, { withTheme } from 'react-jss';
import ReactLoader from 'react-loader';

import { IWithStyle } from '../typings/generic';

interface IProps extends IWithStyle {
  className?: string;
  color?: string;
}

const styles = () => ({
  container: {
    position: 'relative',
    height: 60,
  },
});

class LoaderComponent extends Component<IProps> {
  render() {
    const { classes, className, color, theme } = this.props;

    return (
      <div
        className={classnames({
          [classes.container]: true,
          [`${className}`]: className,
        })}
        data-type="franz-loader"
      >
        <ReactLoader
          loaded={false}
          width={4}
          scale={0.75}
          color={color || theme.colorText}
          parentClassName={classes.loader}
        />
      </div>
    );
  }
}

export const Loader = injectStyle(styles)(withTheme(LoaderComponent));