From 19fd8043bcd8ff0f8f0a85f409480fb36c82618d Mon Sep 17 00:00:00 2001 From: Vijay Aravamudhan Date: Wed, 10 Nov 2021 06:11:01 +0530 Subject: fix: Force the minimum icon size to 2 if the calculated icon size becomes negative. Fixes #2199 (#2204) --- src/features/appearance/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/features/appearance') diff --git a/src/features/appearance/index.ts b/src/features/appearance/index.ts index aa40a5f52..fe8793dc1 100644 --- a/src/features/appearance/index.ts +++ b/src/features/appearance/index.ts @@ -164,6 +164,9 @@ function generateServiceRibbonWidthStyle(widthStr, iconSizeStr, vertical, isLabe tabItemHeightBias = -5; } + // Due to the lowest values for SIDEBAR_WIDTH and ICON_SIZES, this can be computed to a negative value + const minimumAdjustedIconSize = Math.max(width / 2 + iconSize, 2); + return vertical ? ` .sidebar { @@ -177,7 +180,7 @@ function generateServiceRibbonWidthStyle(widthStr, iconSizeStr, vertical, isLabe overflow: hidden !important; } .tab-item .tab-item__icon { - width: ${width / 2 + iconSize}px !important; + width: ${minimumAdjustedIconSize}px !important; } .sidebar__button { font-size: ${width / 3}px !important; @@ -210,7 +213,7 @@ function generateServiceRibbonWidthStyle(widthStr, iconSizeStr, vertical, isLabe height: min-content !important; } .tab-item .tab-item__icon { - width: ${width / 2 + iconSize}px !important; + width: ${minimumAdjustedIconSize}px !important; } .sidebar__button { font-size: ${width / 3}px !important; -- cgit v1.2.3-54-g00ecf