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';
10 type CssRules = 'attribute' | 'label' | 'value' | 'link';
12 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
15 alignItems: 'flex-start',
16 marginBottom: theme.spacing.unit
19 color: theme.palette.grey["500"],
25 alignItems: 'flex-start',
26 textTransform: 'capitalize'
30 color: theme.palette.primary.main,
31 textDecoration: 'none',
32 overflowWrap: 'break-word'
36 interface DetailsAttributeDataProps {
38 value?: string | number;
40 children?: React.ReactNode;
43 type DetailsAttributeProps = DetailsAttributeDataProps & WithStyles<CssRules>;
45 export const DetailsAttribute = withStyles(styles)(({ label, link, value, children, classes }: DetailsAttributeProps) =>
46 <Typography component="div" className={classes.attribute}>
47 <Typography component="span" className={classes.label}>{label}</Typography>
49 ? <a href={link} className={classes.link} target='_blank'>{value}</a>
50 : <Typography component="span" className={classes.value}>