diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-10-14 23:32:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-15 03:02:05 +0530 |
commit | 137555821f172e4eadc7cf099d4270ae8fc1374e (patch) | |
tree | 693882bbf7a6b2a24b5a727091d09586d0371007 /src/features/workspaces/components/WorkspaceServiceListItem.tsx | |
parent | New translations en-US.json (Spanish) (#2072) (diff) | |
download | ferdium-app-137555821f172e4eadc7cf099d4270ae8fc1374e.tar.gz ferdium-app-137555821f172e4eadc7cf099d4270ae8fc1374e.tar.zst ferdium-app-137555821f172e4eadc7cf099d4270ae8fc1374e.zip |
chore: convert components to tsx (#2071)
Diffstat (limited to 'src/features/workspaces/components/WorkspaceServiceListItem.tsx')
-rw-r--r-- | src/features/workspaces/components/WorkspaceServiceListItem.tsx | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/features/workspaces/components/WorkspaceServiceListItem.tsx b/src/features/workspaces/components/WorkspaceServiceListItem.tsx new file mode 100644 index 000000000..b6faaf4ce --- /dev/null +++ b/src/features/workspaces/components/WorkspaceServiceListItem.tsx | |||
@@ -0,0 +1,66 @@ | |||
1 | import { Component } from 'react'; | ||
2 | import { observer } from 'mobx-react'; | ||
3 | import injectSheet from 'react-jss'; | ||
4 | import classnames from 'classnames'; | ||
5 | import { Toggle } from '@meetfranz/forms'; | ||
6 | |||
7 | import ServiceIcon from '../../../components/ui/ServiceIcon'; | ||
8 | |||
9 | const styles = theme => ({ | ||
10 | listItem: { | ||
11 | height: theme.workspaces.settings.listItems.height, | ||
12 | borderBottom: `1px solid ${theme.workspaces.settings.listItems.borderColor}`, | ||
13 | display: 'flex', | ||
14 | alignItems: 'center', | ||
15 | }, | ||
16 | serviceIcon: { | ||
17 | padding: theme.workspaces.settings.listItems.padding, | ||
18 | }, | ||
19 | toggle: { | ||
20 | height: 'auto', | ||
21 | margin: 0, | ||
22 | }, | ||
23 | label: { | ||
24 | padding: theme.workspaces.settings.listItems.padding, | ||
25 | flexGrow: 1, | ||
26 | }, | ||
27 | disabledLabel: { | ||
28 | color: theme.workspaces.settings.listItems.disabled.color, | ||
29 | }, | ||
30 | }); | ||
31 | |||
32 | type Props = { | ||
33 | classes: any; | ||
34 | isInWorkspace: boolean; | ||
35 | onToggle: () => void; | ||
36 | service: any; | ||
37 | }; | ||
38 | |||
39 | @injectSheet(styles) | ||
40 | @observer | ||
41 | class WorkspaceServiceListItem extends Component<Props> { | ||
42 | render() { | ||
43 | const { classes, isInWorkspace, onToggle, service } = this.props; | ||
44 | |||
45 | return ( | ||
46 | <div className={classes.listItem}> | ||
47 | <ServiceIcon className={classes.serviceIcon} service={service} /> | ||
48 | <span | ||
49 | className={classnames([ | ||
50 | classes.label, | ||
51 | service.isEnabled ? null : classes.disabledLabel, | ||
52 | ])} | ||
53 | > | ||
54 | {service.name} | ||
55 | </span> | ||
56 | <Toggle | ||
57 | className={classes.toggle} | ||
58 | checked={isInWorkspace} | ||
59 | onChange={onToggle} | ||
60 | /> | ||
61 | </div> | ||
62 | ); | ||
63 | } | ||
64 | } | ||
65 | |||
66 | export default WorkspaceServiceListItem; | ||