1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import Typography from '@material-ui/core/Typography';
7 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
8 import { ArvadosTheme } from '~/common/custom-theme';
9 import * as classnames from "classnames";
11 type CssRules = 'attribute' | 'label' | 'value' | 'link';
13 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
16 alignItems: 'flex-start',
17 marginBottom: theme.spacing.unit
20 color: theme.palette.grey["500"],
26 alignItems: 'flex-start',
27 textTransform: 'capitalize'
31 color: theme.palette.primary.main,
32 textDecoration: 'none',
33 overflowWrap: 'break-word'
37 interface DetailsAttributeDataProps {
40 value?: string | number;
43 children?: React.ReactNode;
46 type DetailsAttributeProps = DetailsAttributeDataProps & WithStyles<CssRules>;
48 export const DetailsAttribute = withStyles(styles)(
49 ({ label, link, value, children, classes, classLabel, classValue }: DetailsAttributeProps) =>
50 <Typography component="div" className={classes.attribute}>
51 <Typography component="span" className={classnames([classes.label, classLabel])}>{label}</Typography>
53 ? <a href={link} className={classes.link} target='_blank'>{value}</a>
54 : <Typography component="span" className={classnames([classes.value, classValue])}>