mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
30 lines
886 B
TypeScript
30 lines
886 B
TypeScript
import {useTheme} from '@emotion/react';
|
|
|
|
import type {SpanBarType} from 'sentry/components/performance/waterfall/constants';
|
|
import {getSpanBarColours} from 'sentry/components/performance/waterfall/constants';
|
|
import {RowRectangle} from 'sentry/components/performance/waterfall/rowBar';
|
|
import toPercent from 'sentry/utils/number/toPercent';
|
|
|
|
import type {EnhancedSpan} from './types';
|
|
import type {SpanViewBoundsType} from './utils';
|
|
|
|
export default function SpanRectangle({
|
|
bounds,
|
|
spanBarType,
|
|
}: {
|
|
bounds: SpanViewBoundsType;
|
|
spanGrouping: EnhancedSpan[];
|
|
spanBarType?: SpanBarType;
|
|
}) {
|
|
const theme = useTheme();
|
|
return (
|
|
<RowRectangle
|
|
style={{
|
|
backgroundColor: getSpanBarColours(spanBarType, theme).primary,
|
|
left: `min(${toPercent(bounds.left || 0)}, calc(100% - 1px))`,
|
|
width: toPercent(bounds.width || 0),
|
|
}}
|
|
/>
|
|
);
|
|
}
|