aboutsummaryrefslogtreecommitdiffstats
path: root/packages/ui/src/loader/index.tsx
blob: 46545c7864f3fc4e7fac4d3955cf44c1c82242a5 (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
45
46
47
48
import { Theme } from '@meetfranz/theme';
import classnames from 'classnames';
import React, { 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;
}

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

class LoaderComponent extends Component<IProps> {
  render() {
    const {
      classes,
      className,
      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={theme.colorText}
          parentClassName={classes.loader}
        />
      </div>
    );
  }
}

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