Skip to content

Commit a5132d9

Browse files
fix(metric): remove support for small responsive breakpoints (#2743)
* Disable smaller breakpoints * Remove pixel buffer because is no longer needed ⸜( ´ ꒳ ` )⸝ * test(vrt): update screenshots [skip ci] * test(vrt): update screenshots [skip ci] --------- Co-authored-by: elastic-datavis[bot] <98618603+elastic-datavis[bot]@users.noreply.github.com>
1 parent 0f55808 commit a5132d9

10 files changed

Lines changed: 2 additions & 9 deletions
Loading
Loading
Loading
Loading
Loading
Loading
3.04 KB
Loading
973 Bytes
Loading
897 Bytes
Loading

packages/charts/src/chart_types/metric/renderer/dom/text_measurements.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ export const PADDING = 8;
8181
export const PROGRESS_BAR_TARGET_SIZE = 8; // Aligned with our CSS in _index.scss
8282
const LINE_HEIGHT = 1.2; // Aligned with our CSS
8383
const HEIGHT_BP: [number, number, BreakPoint][] = [
84-
[0, 100, 'xxxs'],
85-
[100, 150, 'xxs'],
86-
[150, 200, 'xs'],
84+
[100, 200, 'xs'],
8785
[200, 300, 's'],
8886
[300, 400, 'm'],
8987
[400, 500, 'l'],
@@ -138,9 +136,6 @@ const SUBTITLE_FONT: Font = {
138136
const PROGRESS_BAR_THICKNESS: Record<BreakPoint, number> = { xxxs: 4, xxs: 4, xs: 8, s: 8, m: 8, l: 8, xl: 8, xxl: 16 };
139137
const ELEMENT_PADDING = 5; // Aligned with our CSS in _text.scss
140138

141-
const LAYOUT_PIXEL_BUFFER = 26;
142-
const SMALL_HEIGHT_THRESHOLD = 200;
143-
144139
/**
145140
* Approximate font size to fit given available space
146141
* @internal
@@ -368,9 +363,7 @@ function computeMetricTextLayout(
368363
/** Determines if the given breakpoint should be considered "visible" for the provided text measurement */
369364
const isVisible = (breakpoints: ResponsiveBreakpoints, measure: TextMeasure) => {
370365
const { totalHeight } = computeMetricTextSize(breakpoints, measure);
371-
const buffer = panel.height <= SMALL_HEIGHT_THRESHOLD ? LAYOUT_PIXEL_BUFFER : 0;
372-
const fits = totalHeight <= panel.height - buffer;
373-
return fits;
366+
return totalHeight <= panel.height;
374367
};
375368

376369
return withTextMeasure((textMeasure) => {

0 commit comments

Comments
 (0)