// Copyright (C) The Arvados Authors. All rights reserved. // // SPDX-License-Identifier: AGPL-3.0 import * as React from 'react'; import Typography from '@material-ui/core/Typography'; import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles'; import { ArvadosTheme } from 'src/common/custom-theme'; interface AttributeDataProps { label: string; value?: string; link?: string; } type AttributeProps = AttributeDataProps & WithStyles; class Attribute extends React.Component { hasLink() { return !!this.props.link; } render() { const { label, link, value, children, classes } = this.props; return {label} { this.hasLink() ? ( {value} ) : ( {value} {children} )} ; } } type CssRules = 'attribute' | 'label' | 'value' | 'link'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ attribute: { height: '24px', display: 'flex', alignItems: 'center', marginBottom: theme.spacing.unit }, label: { color: theme.palette.grey["500"], width: '40%' }, value: { display: 'flex', alignItems: 'center' }, link: { color: theme.palette.primary.main, textDecoration: 'none' } }); export default withStyles(styles)(Attribute);