mirror of
https://github.com/grafana/grafana.git
synced 2025-01-15 19:22:34 -06:00
80294b2dbf
* WIP: Using new components * Progress * Everything looks to be working * Explore: Replaces navbar-button and overriden explore button css classes with ToolbarButton and cleans up scss & markup, removes ResponsiveButton (#30571) * Explore: Replaces navbar-button and overriden explore button css classes with ToolbarButton and cleans up scss & markup, removes ResponsiveButton * Change live button text when paused * Fixed story * For the dashboard toolbar button I need a transparent button so I refactored the states/variants into a new ToolbarButtonVariatn * Changing my mind on the transparent variant * review fixes * Review fixes
29 lines
736 B
TypeScript
29 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' : 'default'}
|
|
aria-label={isSynced ? 'Synced times' : 'Unsynced times'}
|
|
onClick={onClick}
|
|
/>
|
|
</Tooltip>
|
|
);
|
|
}
|