diff options
author | 2022-11-20 17:35:21 +0530 | |
---|---|---|
committer | 2022-11-20 17:35:21 +0530 | |
commit | 86f9ab693dcad951271f727046214b03d91ebd69 (patch) | |
tree | 3d32ff4814b5484495b811c5fe0ebea4805f4e55 /src/components/ui/ServiceIcon.tsx | |
parent | 6.2.1-nightly.47 [skip ci] (diff) | |
download | ferdium-app-86f9ab693dcad951271f727046214b03d91ebd69.tar.gz ferdium-app-86f9ab693dcad951271f727046214b03d91ebd69.tar.zst ferdium-app-86f9ab693dcad951271f727046214b03d91ebd69.zip |
Transform Todo feature, ServiceBarTargetUrl, ServiceIcon, TeamDashboard, Slider, Loader & WorkspaceSwitchningIndicator into ts (#782)
Diffstat (limited to 'src/components/ui/ServiceIcon.tsx')
-rw-r--r-- | src/components/ui/ServiceIcon.tsx | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/components/ui/ServiceIcon.tsx b/src/components/ui/ServiceIcon.tsx new file mode 100644 index 000000000..39a32e44d --- /dev/null +++ b/src/components/ui/ServiceIcon.tsx | |||
@@ -0,0 +1,52 @@ | |||
1 | import { Component, ReactNode } from 'react'; | ||
2 | import { observer } from 'mobx-react'; | ||
3 | import withStyles, { WithStylesProps } from 'react-jss'; | ||
4 | import classnames from 'classnames'; | ||
5 | import ServiceModel from '../../models/Service'; | ||
6 | |||
7 | const styles = theme => ({ | ||
8 | root: { | ||
9 | height: 'auto', | ||
10 | }, | ||
11 | icon: { | ||
12 | width: theme.serviceIcon.width, | ||
13 | }, | ||
14 | isCustomIcon: { | ||
15 | width: theme.serviceIcon.isCustom.width, | ||
16 | border: theme.serviceIcon.isCustom.border, | ||
17 | borderRadius: theme.serviceIcon.isCustom.borderRadius, | ||
18 | }, | ||
19 | isDisabled: { | ||
20 | filter: 'grayscale(100%)', | ||
21 | opacity: '.5', | ||
22 | }, | ||
23 | }); | ||
24 | |||
25 | interface IProps extends WithStylesProps<typeof styles> { | ||
26 | service: ServiceModel; | ||
27 | className?: string; | ||
28 | } | ||
29 | |||
30 | // TODO - [TS DEBT] Should this file be converted into the coding style similar to './toggle/index.tsx'? | ||
31 | @observer | ||
32 | class ServiceIcon extends Component<IProps> { | ||
33 | render(): ReactNode { | ||
34 | const { classes, className = '', service } = this.props; | ||
35 | |||
36 | return ( | ||
37 | <div className={classnames([classes.root, className])}> | ||
38 | <img | ||
39 | src={service.icon} | ||
40 | className={classnames([ | ||
41 | classes.icon, | ||
42 | service.isEnabled ? null : classes.isDisabled, | ||
43 | service.hasCustomIcon ? classes.isCustomIcon : null, | ||
44 | ])} | ||
45 | alt="" | ||
46 | /> | ||
47 | </div> | ||
48 | ); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | export default withStyles(styles, { injectTheme: true })(ServiceIcon); | ||