Skip to content

Commit

Permalink
chore(ui5-wizard): make use of base util mehtod (#3093)
Browse files Browse the repository at this point in the history
This is a follow up of a review comment from #3009
to make us of an existing method instead of local implementation.
  • Loading branch information
ilhan007 authored Apr 5, 2021
1 parent cc31280 commit 3508ba8
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions packages/fiori/src/Wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { getEffectiveAriaLabelText } from "@ui5/webcomponents-base/dist/util/Ari
import ItemNavigation from "@ui5/webcomponents-base/dist/delegate/ItemNavigation.js";
import NavigationMode from "@ui5/webcomponents-base/dist/types/NavigationMode.js";
import Float from "@ui5/webcomponents-base/dist/types/Float.js";
import clamp from "@ui5/webcomponents-base/dist/util/clamp.js";
import ResizeHandler from "@ui5/webcomponents-base/dist/delegate/ResizeHandler.js";
import { isPhone } from "@ui5/webcomponents-base/dist/Device.js";
import debounce from "@ui5/webcomponents-base/dist/util/debounce.js";
Expand Down Expand Up @@ -35,6 +36,12 @@ const AFTER_EXPANDED_STEP = "data-ui5-wizard-expanded-tab-next";
const AFTER_CURRENT_STEP = "data-ui5-wizard-after-current-tab";
const BEFORE_EXPANDED_STEP = "data-ui5-wizard-expanded-tab-prev";

const STEP_SWITCH_THRESHOLDS = {
MIN: 0.5,
DEFAULT: 0.7,
MAX: 1,
};

/**
* @public
*/
Expand Down Expand Up @@ -81,7 +88,7 @@ const metadata = {
*/
stepSwitchThreshold: {
type: Float,
defaultValue: 0.7,
defaultValue: STEP_SWITCH_THRESHOLDS.DEFAULT,
},

/**
Expand Down Expand Up @@ -757,15 +764,7 @@ class Wizard extends UI5Element {
}

get effectiveStepSwitchThreshold() {
if (this.stepSwitchThreshold < 0.5) {
return 0.5;
}

if (this.stepSwitchThreshold > 1) {
return 1;
}

return this.stepSwitchThreshold;
return clamp(this.stepSwitchThreshold, STEP_SWITCH_THRESHOLDS.MIN, STEP_SWITCH_THRESHOLDS.MAX);
}

/**
Expand Down

0 comments on commit 3508ba8

Please sign in to comment.