mirror of https://github.com/grafana/grafana
parent
42cc6b1842
commit
70cb87380d
@ -1,48 +0,0 @@ |
||||
import { css, cx } from '@emotion/css'; |
||||
import React from 'react'; |
||||
|
||||
import { useStyles2 } from '../../themes'; |
||||
import { commonColorsPalette } from '../../themes/default'; |
||||
import { Icon } from '../Icon/Icon'; |
||||
import { Tooltip } from '../Tooltip/Tooltip'; |
||||
|
||||
/** |
||||
* @internal |
||||
*/ |
||||
export type ErrorIndicatorProps = { |
||||
error?: string; |
||||
onClick?: () => void; |
||||
}; |
||||
|
||||
/** |
||||
* @internal |
||||
*/ |
||||
export const ErrorIndicator = ({ error, onClick }: ErrorIndicatorProps) => { |
||||
const styles = useStyles2(getStyles); |
||||
|
||||
if (!error) { |
||||
return null; |
||||
} |
||||
|
||||
return ( |
||||
<Tooltip theme="error" content={error}> |
||||
<Icon |
||||
onClick={onClick} |
||||
className={cx(styles.icon, { [styles.clickable]: !!onClick })} |
||||
size="sm" |
||||
name="exclamation-triangle" |
||||
/> |
||||
</Tooltip> |
||||
); |
||||
}; |
||||
|
||||
const getStyles = () => { |
||||
return { |
||||
clickable: css({ |
||||
cursor: 'pointer', |
||||
}), |
||||
icon: css({ |
||||
color: `${commonColorsPalette.red88}`, |
||||
}), |
||||
}; |
||||
}; |
||||
Loading…
Reference in new issue