mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 06:02:24 +08:00

* i18n: removes useTranslate hook * chore: fix duplicate imports * chore: fix import sorting and hook dependencies
35 lines
794 B
TypeScript
35 lines
794 B
TypeScript
import { css } from '@emotion/css';
|
|
import * as React from 'react';
|
|
|
|
import { GrafanaTheme2 } from '@grafana/data';
|
|
import { t } from '@grafana/i18n';
|
|
import { IconButton, useStyles2 } from '@grafana/ui';
|
|
|
|
type Props = {
|
|
onClick: () => void;
|
|
'aria-label'?: string;
|
|
style?: React.CSSProperties;
|
|
};
|
|
|
|
export const CloseButton = ({ onClick, 'aria-label': ariaLabel, style }: Props) => {
|
|
const styles = useStyles2(getStyles);
|
|
|
|
return (
|
|
<IconButton
|
|
aria-label={ariaLabel ?? 'Close'}
|
|
className={styles}
|
|
name="times"
|
|
onClick={onClick}
|
|
style={style}
|
|
tooltip={t('close-button.tooltip', 'Close')}
|
|
/>
|
|
);
|
|
};
|
|
|
|
const getStyles = (theme: GrafanaTheme2) =>
|
|
css({
|
|
position: 'absolute',
|
|
right: theme.spacing(0.5),
|
|
top: theme.spacing(1),
|
|
});
|