From 75d8d75fcab5f6daedd21c1213a768001eda4064 Mon Sep 17 00:00:00 2001 From: Ken <49991972+knesbit-cars@users.noreply.github.com> Date: Wed, 4 Oct 2023 14:01:12 -0500 Subject: [PATCH] Update clamp-builder.ts for min max --- utils/clamp-builder.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/clamp-builder.ts b/utils/clamp-builder.ts index 4869a35f..109c5e70 100644 --- a/utils/clamp-builder.ts +++ b/utils/clamp-builder.ts @@ -41,8 +41,8 @@ export default function clampBuilder(options: { const slope = (maxFontSize - minFontSize) / (maxWidth - minWidth); const yAxisIntersection = toFixed(-minWidth * slope + minFontSize); - const min = `${minFontSize}rem`; - const max = `${maxFontSize}rem`; + const min = `${Math.min(minFontSize, maxFontSize)}rem`; + const max = `${Math.max(minFontSize, maxFontSize)}rem`; const preferred = `${yAxisIntersection}rem + ${toFixed(slope * 100)}vw`; return `clamp(${min}, ${preferred}, ${max})`;