Skip to content

Commit

Permalink
Update clamp-builder.ts for min max
Browse files Browse the repository at this point in the history
  • Loading branch information
knesbit-cars authored Oct 4, 2023
1 parent c93bef3 commit 75d8d75
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/clamp-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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})`;
Expand Down

0 comments on commit 75d8d75

Please sign in to comment.