mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 16:45:43 -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
30 lines
737 B
TypeScript
30 lines
737 B
TypeScript
import React from 'react';
|
|
|
|
import { Tooltip, ToolbarButton } from '@grafana/ui';
|
|
|
|
interface TimeSyncButtonProps {
|
|
isSynced: boolean;
|
|
onClick: () => void;
|
|
}
|
|
|
|
export function TimeSyncButton(props: TimeSyncButtonProps) {
|
|
const { onClick, isSynced } = props;
|
|
|
|
const syncTimesTooltip = () => {
|
|
const { isSynced } = props;
|
|
const tooltip = isSynced ? 'Unsync all views' : 'Sync all views to this time range';
|
|
return <>{tooltip}</>;
|
|
};
|
|
|
|
return (
|
|
<Tooltip content={syncTimesTooltip} placement="bottom">
|
|
<ToolbarButton
|
|
icon="link"
|
|
variant={isSynced ? 'active' : 'default'}
|
|
aria-label={isSynced ? 'Synced times' : 'Unsynced times'}
|
|
onClick={onClick}
|
|
/>
|
|
</Tooltip>
|
|
);
|
|
}
|