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
49
50
51
52
53
54
55
56
|
import { Component } from 'react';
import { observer, inject } from 'mobx-react';
import PropTypes from 'prop-types';
import Loader from 'react-loader';
import { oneOrManyChildElements } from '../../prop-types';
@inject('stores')
@observer
class LoaderComponent extends Component {
static propTypes = {
children: oneOrManyChildElements,
loaded: PropTypes.bool,
className: PropTypes.string,
color: PropTypes.string,
stores: PropTypes.shape({
settings: PropTypes.shape({
app: PropTypes.shape({
accentColor: PropTypes.string.isRequired,
}).isRequired,
}).isRequired,
}).isRequired,
};
static defaultProps = {
children: null,
loaded: false,
className: '',
color: 'ACCENT',
};
render() {
const { children, loaded, className } = this.props;
const color =
this.props.color !== 'ACCENT'
? this.props.color
: this.props.stores.settings.app.accentColor;
return (
<Loader
loaded={loaded}
// lines={10}
width={4}
scale={0.6}
color={color}
component="span"
className={className}
>
{children}
</Loader>
);
}
}
export default LoaderComponent;
|