Files
grafana/public/app/features/dashboard/components/PanelEditor/OptionsPaneItemOverrides.tsx
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

51 lines
1.2 KiB
TypeScript

import { css } from '@emotion/css';
import { GrafanaTheme2 } from '@grafana/data';
import { Tooltip, useStyles2 } from '@grafana/ui';
import { OptionPaneItemOverrideInfo } from './types';
export interface Props {
overrides: OptionPaneItemOverrideInfo[];
}
export function OptionsPaneItemOverrides({ overrides }: Props) {
const styles = useStyles2(getStyles);
return (
<div className={styles.wrapper}>
{overrides.map((override, index) => (
<Tooltip content={override.tooltip} key={index.toString()} placement="top">
<div aria-label={override.description} className={styles[override.type]} />
</Tooltip>
))}
</div>
);
}
const getStyles = (theme: GrafanaTheme2) => {
const common = {
width: 8,
height: 8,
borderRadius: theme.shape.radius.circle,
marginLeft: theme.spacing(1),
top: '-1px',
};
return {
wrapper: css({
display: 'flex',
}),
rule: css({
...common,
position: 'relative',
backgroundColor: theme.colors.primary.main,
}),
data: css({
...common,
position: 'relative',
backgroundColor: theme.colors.warning.main,
}),
};
};