X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/8dda39e1ac1e43d08881b8ac19db92c18d1cb4fe..58800bbe6e474679dcfbc03735541a578280dd85:/src/components/list-item-text-icon/list-item-text-icon.tsx diff --git a/src/components/list-item-text-icon/list-item-text-icon.tsx b/src/components/list-item-text-icon/list-item-text-icon.tsx index f140d860..226556aa 100644 --- a/src/components/list-item-text-icon/list-item-text-icon.tsx +++ b/src/components/list-item-text-icon/list-item-text-icon.tsx @@ -2,61 +2,65 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from 'react'; +import React from 'react'; import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles'; -import { ArvadosTheme } from '../../common/custom-theme'; +import { ArvadosTheme } from 'common/custom-theme'; import { ListItemIcon, ListItemText, Typography } from '@material-ui/core'; import { IconType } from '../icon/icon'; -import * as classnames from "classnames"; +import classnames from "classnames"; -export interface ListItemTextIconDataProps { - icon: IconType; - name: string; - isActive?: boolean; - hasMargin?: boolean; -} - -type ListItemTextIconProps = ListItemTextIconDataProps & WithStyles; - -class ListItemTextIcon extends React.Component { - render() { - const { classes, isActive, hasMargin, name, icon: Icon } = this.props; - return ( - - - - - - {name} - - } /> - - ); - } -} - type CssRules = 'root' | 'listItemText' | 'hasMargin' | 'active'; - + const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { display: 'flex', alignItems: 'center' }, listItemText: { - fontWeight: 700 + fontWeight: 400 }, active: { color: theme.palette.primary.main, }, hasMargin: { - marginLeft: '18px', - }, + marginLeft: `${theme.spacing.unit}px`, + } }); -export default withStyles(styles)(ListItemTextIcon); \ No newline at end of file +export interface ListItemTextIconDataProps { + icon: IconType; + name: string; + isActive?: boolean; + hasMargin?: boolean; + iconSize?: number; + nameDecorator?: JSX.Element; +} + +type ListItemTextIconProps = ListItemTextIconDataProps & WithStyles; + +export const ListItemTextIcon = withStyles(styles)( + class extends React.Component { + render() { + const { classes, isActive, hasMargin, name, icon: Icon, iconSize, nameDecorator } = this.props; + return ( + + + + + + {nameDecorator || null} + + {name} + + } /> + + ); + } + } +);