grafana/public/app/features/alerting/unified/components/AlertLabel.tsx
Josh Hunt 3c6e0e8ef8
Chore: ESlint import order (#44959)
* 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
2022-04-22 14:33:13 +01:00

34 lines
970 B
TypeScript

import { css } from '@emotion/css';
import React, { FC } from 'react';
import { GrafanaTheme } from '@grafana/data';
import { IconButton, useStyles } from '@grafana/ui';
interface Props {
labelKey: string;
value: string;
operator?: string;
onRemoveLabel?: () => void;
}
export const AlertLabel: FC<Props> = ({ labelKey, value, operator = '=', onRemoveLabel }) => (
<div className={useStyles(getStyles)}>
{labelKey}
{operator}
{value}
{!!onRemoveLabel && <IconButton name="times" size="xs" onClick={onRemoveLabel} />}
</div>
);
export const getStyles = (theme: GrafanaTheme) => css`
padding: ${theme.spacing.xs} ${theme.spacing.sm};
border-radius: ${theme.border.radius.sm};
border: solid 1px ${theme.colors.border2};
font-size: ${theme.typography.size.sm};
background-color: ${theme.colors.bg2};
font-weight: ${theme.typography.weight.bold};
color: ${theme.colors.formLabel};
display: inline-block;
line-height: 1.2;
`;