@zendesk/react-measure-timing-hooks
Version:
react hooks for measuring time to interactive and time to render of components
32 lines (31 loc) • 1.4 kB
TypeScript
import React from 'react';
import type { BarProps } from '@visx/shape/lib/shapes/Bar';
import type { LineProps } from '@visx/shape/lib/shapes/Line';
import type { AddSVGProps } from '@visx/shape/lib/types';
import type { WithTooltipProvidedProps } from '@visx/tooltip/lib/enhancers/withTooltip';
import type { ScaleBand, ScaleLinear } from '@visx/vendor/d3-scale';
import type { MappedSpanAndAnnotation } from '../types';
interface SharedAnnotationProps {
xScale: ScaleLinear<number, number, never>;
yScale: ScaleBand<string>;
yMax: number;
titleColor?: string;
title?: string;
annotateAt?: 'top';
data: MappedSpanAndAnnotation;
showTooltip: (data: Partial<WithTooltipProvidedProps<MappedSpanAndAnnotation>>) => void;
hideTooltip: () => void;
}
interface InteractiveLineSpanProps extends SharedAnnotationProps, Omit<AddSVGProps<LineProps, SVGLineElement>, 'ref'> {
type: 'line';
onClick: () => void;
scrollContainerRef: React.RefObject<HTMLDivElement>;
}
interface InteractiveBarSpanProps extends SharedAnnotationProps, Omit<AddSVGProps<BarProps, SVGRectElement>, 'ref'> {
type: 'bar';
onClick: () => void;
scrollContainerRef: React.RefObject<HTMLDivElement>;
}
type InteractiveSpanProps = InteractiveLineSpanProps | InteractiveBarSpanProps;
declare const InteractiveSpan: React.FC<InteractiveSpanProps>;
export default InteractiveSpan;