12345678910111213141516171819202122232425262728293031323334353637 |
- import {useCallback} from 'react';
- import styled from '@emotion/styled';
- import {Button} from 'sentry/components/button';
- import {t} from 'sentry/locale';
- import type {Organization} from 'sentry/types/organization';
- import {traceAnalytics} from 'sentry/views/performance/newTraceDetails/traceAnalytics';
- import type {VirtualizedViewManager} from 'sentry/views/performance/newTraceDetails/traceRenderers/virtualizedViewManager';
- export function TraceResetZoomButton(props: {
- organization: Organization;
- viewManager: VirtualizedViewManager;
- }) {
- const onResetZoom = useCallback(() => {
- traceAnalytics.trackResetZoom(props.organization);
- props.viewManager.resetZoom();
- }, [props.viewManager, props.organization]);
- return (
- <ResetZoomButton
- size="xs"
- onClick={onResetZoom}
- ref={props.viewManager.registerResetZoomRef}
- >
- {t('Reset Zoom')}
- </ResetZoomButton>
- );
- }
- const ResetZoomButton = styled(Button)`
- transition: opacity 0.2s 0.5s ease-in-out;
- &[disabled] {
- cursor: not-allowed;
- opacity: 0.65;
- }
- `;
|