mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
dfed7e59a5
* Explore: remove topnav * PageToolbar: fix left items margin when no title or page icon is set * add missing key prop & fix tests * use canvas variant in live logs * avoid rendering empty space * fix test * avoid disabling split resize button when live tailing * minor touchups * Update packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx Co-authored-by: Torkel Ödegaard <torkel@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
30 lines
736 B
TypeScript
30 lines
736 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' : 'canvas'}
|
|
aria-label={isSynced ? 'Synced times' : 'Unsynced times'}
|
|
onClick={onClick}
|
|
/>
|
|
</Tooltip>
|
|
);
|
|
}
|