mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
* 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
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import { css } from '@emotion/css';
|
|
import { noop } from 'lodash';
|
|
import React from 'react';
|
|
|
|
import { GrafanaTheme } from '@grafana/data';
|
|
import { Icon, useStyles } from '@grafana/ui';
|
|
|
|
type VersionHistoryHeaderProps = {
|
|
isComparing?: boolean;
|
|
onClick?: () => void;
|
|
baseVersion?: number;
|
|
newVersion?: number;
|
|
isNewLatest?: boolean;
|
|
};
|
|
|
|
export const VersionHistoryHeader: React.FC<VersionHistoryHeaderProps> = ({
|
|
isComparing = false,
|
|
onClick = noop,
|
|
baseVersion = 0,
|
|
newVersion = 0,
|
|
isNewLatest = false,
|
|
}) => {
|
|
const styles = useStyles(getStyles);
|
|
|
|
return (
|
|
<h3 className={styles.header}>
|
|
<span onClick={onClick} className={isComparing ? 'pointer' : ''}>
|
|
Versions
|
|
</span>
|
|
{isComparing && (
|
|
<span>
|
|
<Icon name="angle-right" /> Comparing {baseVersion} <Icon name="arrows-h" /> {newVersion}{' '}
|
|
{isNewLatest && <cite className="muted">(Latest)</cite>}
|
|
</span>
|
|
)}
|
|
</h3>
|
|
);
|
|
};
|
|
|
|
const getStyles = (theme: GrafanaTheme) => ({
|
|
header: css`
|
|
font-size: ${theme.typography.heading.h3};
|
|
margin-bottom: ${theme.spacing.lg};
|
|
`,
|
|
});
|