Files
Ashley Harrison 47f8717149 React: Use new JSX transform (#88802)
* update eslint, tsconfig + esbuild to handle new jsx transform

* remove thing that breaks the new jsx transform

* remove react imports

* adjust grafana-icons build

* is this the correct syntax?

* try this

* well this was much easier than expected...

* change grafana-plugin-configs webpack config

* fixes

* fix lockfile

* fix 2 more violations

* use path.resolve instead of require.resolve

* remove react import

* fix react imports

* more fixes

* remove React import

* remove import React from docs

* remove another react import
2024-06-25 12:43:47 +01:00

53 lines
1.3 KiB
TypeScript

import { css } from '@emotion/css';
import { Fragment } from 'react';
import { GrafanaTheme2 } from '@grafana/data';
import { useStyles2 } from '@grafana/ui';
import { PageInfoItem } from '../Page/types';
export interface Props {
info: PageInfoItem[];
}
export function PageInfo({ info }: Props) {
const styles = useStyles2(getStyles);
return (
<div className={styles.container}>
{info.map((infoItem, index) => (
<Fragment key={index}>
<div className={styles.infoItem}>
<div className={styles.label}>{infoItem.label}</div>
{infoItem.value}
</div>
{index + 1 < info.length && <div data-testid="page-info-separator" className={styles.separator} />}
</Fragment>
))}
</div>
);
}
const getStyles = (theme: GrafanaTheme2) => {
return {
container: css({
display: 'flex',
flexDirection: 'row',
gap: theme.spacing(1.5),
overflow: 'auto',
}),
infoItem: css({
...theme.typography.bodySmall,
display: 'flex',
flexDirection: 'column',
gap: theme.spacing(0.5),
}),
label: css({
color: theme.colors.text.secondary,
}),
separator: css({
borderLeft: `1px solid ${theme.colors.border.weak}`,
}),
};
};