1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
7 import { ArvadosTheme } from '~/common/custom-theme';
8 import { ListItemIcon, ListItemText, Typography } from '@material-ui/core';
9 import { IconType } from '../icon/icon';
10 import * as classnames from "classnames";
12 type CssRules = 'root' | 'listItemText' | 'hasMargin' | 'active';
14 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
23 color: theme.palette.primary.main,
26 marginLeft: `${theme.spacing.unit}px`,
30 export interface ListItemTextIconDataProps {
37 type ListItemTextIconProps = ListItemTextIconDataProps & WithStyles<CssRules>;
39 export const ListItemTextIcon = withStyles(styles)(
40 class extends React.Component<ListItemTextIconProps, {}> {
42 const { classes, isActive, hasMargin, name, icon: Icon } = this.props;
44 <Typography component='span' className={classes.root}>
45 <ListItemIcon className={classnames({
46 [classes.hasMargin]: hasMargin,
47 [classes.active]: isActive
51 <ListItemText primary={
52 <Typography variant='body1' className={classnames(classes.listItemText, {
53 [classes.active]: isActive