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
|
import { Component, ReactNode } from 'react';
import { observer } from 'mobx-react';
import withStyles, { WithStylesProps } from 'react-jss';
import classnames from 'classnames';
import ServiceModel from '../../models/Service';
const styles = theme => ({
root: {
height: 'auto',
},
icon: {
width: theme.serviceIcon.width,
},
isCustomIcon: {
width: theme.serviceIcon.isCustom.width,
border: theme.serviceIcon.isCustom.border,
borderRadius: theme.serviceIcon.isCustom.borderRadius,
},
isDisabled: {
filter: 'grayscale(100%)',
opacity: '.5',
},
});
interface IProps extends WithStylesProps<typeof styles> {
service: ServiceModel;
className?: string;
}
// TODO: [TS DEBT] Should this file be converted into the coding style similar to './toggle/index.tsx'?
@observer
class ServiceIcon extends Component<IProps> {
render(): ReactNode {
const { classes, className = '', service } = this.props;
return (
<div className={classnames([classes.root, className])}>
<img
src={service.icon}
className={classnames([
classes.icon,
service.isEnabled ? null : classes.isDisabled,
service.hasCustomIcon ? classes.isCustomIcon : null,
])}
alt=""
/>
</div>
);
}
}
export default withStyles(styles, { injectTheme: true })(ServiceIcon);
|