aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/workspaces/components/WorkspaceItem.tsx
blob: f24e6a85df43f11647991e502bb74c82976d2b43 (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
import { noop } from 'lodash';
import { observer } from 'mobx-react';
import { Component, type ReactElement } from 'react';
import withStyles, { type WithStylesProps } from 'react-jss';
import type Workspace from '../models/Workspace';

const styles = theme => ({
  row: {
    height: theme.workspaces.settings.listItems.height,
    borderBottom: `1px solid ${theme.workspaces.settings.listItems.borderColor}`,
    '&:hover': {
      background: theme.workspaces.settings.listItems.hoverBgColor,
    },
  },
  columnName: {},
});

interface IProps extends WithStylesProps<typeof styles> {
  workspace: Workspace;
  onItemClick: (workspace: Workspace) => void;
}

@observer
class WorkspaceItem extends Component<IProps> {
  render(): ReactElement {
    const { classes, workspace, onItemClick } = this.props;

    return (
      <tr className={classes.row}>
        <td onClick={() => onItemClick(workspace)} onKeyDown={noop}>
          {workspace.name}
        </td>
      </tr>
    );
  }
}

export default withStyles(styles, { injectTheme: true })(WorkspaceItem);