mirror of
https://github.com/grafana/grafana.git
synced 2025-09-20 10:11:56 +08:00

* Add and configure eslint-plugin-import * Fix the lint:ts npm command * Autofix + prettier all the files * Manually fix remaining files * Move jquery code in jest-setup to external file to safely reorder imports * Resolve issue caused by circular dependencies within Prometheus * Update .betterer.results * Fix missing // @ts-ignore * ignore iconBundle.ts * Fix missing // @ts-ignore
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
import { css, cx } from '@emotion/css';
|
|
import React, { FC } from 'react';
|
|
|
|
import { GrafanaTheme2 } from '@grafana/data';
|
|
import { useStyles2 } from '@grafana/ui';
|
|
|
|
interface Props {
|
|
label: React.ReactNode;
|
|
className?: string;
|
|
horizontal?: boolean;
|
|
}
|
|
|
|
export const DetailsField: FC<Props> = ({ className, label, horizontal, children }) => {
|
|
const styles = useStyles2(getStyles);
|
|
|
|
return (
|
|
<div className={cx(className, styles.field, horizontal ? styles.fieldHorizontal : styles.fieldVertical)}>
|
|
<div>{label}</div>
|
|
<div>{children}</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
const getStyles = (theme: GrafanaTheme2) => ({
|
|
fieldHorizontal: css`
|
|
flex-direction: row;
|
|
${theme.breakpoints.down('md')} {
|
|
flex-direction: column;
|
|
}
|
|
`,
|
|
fieldVertical: css`
|
|
flex-direction: column;
|
|
`,
|
|
field: css`
|
|
display: flex;
|
|
margin: ${theme.spacing(2)} 0;
|
|
|
|
& > div:first-child {
|
|
width: 110px;
|
|
padding-right: ${theme.spacing(1)};
|
|
font-size: ${theme.typography.size.sm};
|
|
font-weight: ${theme.typography.fontWeightBold};
|
|
line-height: 1.8;
|
|
}
|
|
& > div:nth-child(2) {
|
|
flex: 1;
|
|
color: ${theme.colors.text.secondary};
|
|
}
|
|
`,
|
|
});
|