From bdf623dab54132f257057a6949d0a1e245d0b468 Mon Sep 17 00:00:00 2001 From: fragosti Date: Mon, 22 Oct 2018 16:54:08 -0700 Subject: chore: refactor ScalingInput --- packages/instant/src/components/scaling_input.tsx | 27 +++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'packages/instant/src') diff --git a/packages/instant/src/components/scaling_input.tsx b/packages/instant/src/components/scaling_input.tsx index 7824c10f9..c1111cea9 100644 --- a/packages/instant/src/components/scaling_input.tsx +++ b/packages/instant/src/components/scaling_input.tsx @@ -58,9 +58,12 @@ export class ScalingInput extends React.Component ); } - private readonly _calculateWidth = (): string => { - const phase = ScalingInput.getPhaseFromProps(this.props); + private readonly _calculateWidth = (phase: ScalingInputPhase): string => { const { value, startWidthCh, endWidthCh } = this.props; if (_.isUndefined(value)) { return `${startWidthCh}ch`; @@ -136,6 +142,9 @@ export class ScalingInput extends React.Component { + return ScalingInput.calculateFontSizeFromProps(this.props, phase); + }; private readonly _getInputWidthInPx = (): number => { const ref = this._inputRef.current; if (!ref) { -- cgit v1.2.3