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 {
38 type ListItemTextIconProps = ListItemTextIconDataProps & WithStyles<CssRules>;
40 export const ListItemTextIcon = withStyles(styles)(
41 class extends React.Component<ListItemTextIconProps, {}> {
43 const { classes, isActive, hasMargin, name, icon: Icon, iconSize } = this.props;
45 <Typography component='span' className={classes.root}>
46 <ListItemIcon className={classnames({
47 [classes.hasMargin]: hasMargin,
48 [classes.active]: isActive
51 <Icon style={{ fontSize: `${iconSize}rem` }} />
53 <ListItemText primary={
54 <Typography variant='body1' className={classnames(classes.listItemText, {
55 [classes.active]: isActive