diff --git a/src/shared/components/calculator/calculator-display.tsx b/src/shared/components/calculator/calculator-display.tsx index 226df19..b3dc0b1 100644 --- a/src/shared/components/calculator/calculator-display.tsx +++ b/src/shared/components/calculator/calculator-display.tsx @@ -11,6 +11,20 @@ type CalculatorDisplayProps = { isResultView: boolean; }; +const getExpressionSizeClass = (length: number, compact: boolean) => { + if (compact) { + if (length <= 14) return "text-2xl"; + if (length <= 20) return "text-xl"; + if (length <= 28) return "text-base"; + return "text-sm"; + } + if (length <= 12) return "text-3xl"; + if (length <= 18) return "text-2xl"; + if (length <= 24) return "text-xl"; + if (length <= 32) return "text-base"; + return "text-sm"; +}; + export function CalculatorDisplay({ history, expression, @@ -19,8 +33,10 @@ export function CalculatorDisplay({ onCopy, isResultView, }: CalculatorDisplayProps) { + const sizeClass = getExpressionSizeClass(expression.length, isResultView); + return ( -
+
{history ?? ( )}
-
+
{expression}