Skip to content

Commit

Permalink
fix(select): RTL fix for searchbar (#11355)
Browse files Browse the repository at this point in the history
* fix(select): RTL fix for searchbar

RTL fix for searchbar component

* fix bad reference

I forgot to refrence _isRTL

* use platform variable instead of method

* space indent instead of tab indent

* Remove scss changes per request

PR - #11342 - covers the scss, and is about done
  • Loading branch information
sijav authored and brandyscarney committed May 17, 2017
1 parent 257b5fc commit ca71072
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/components/searchbar/searchbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,19 @@ export class Searchbar extends BaseInput<string> {

// Set the input padding start
var inputLeft = 'calc(50% - ' + (textWidth / 2) + 'px)';
inputEle.style.paddingLeft = inputLeft;
if (this._plt.isRTL) {
inputEle.style.paddingRight = inputLeft;
} else {
inputEle.style.paddingLeft = inputLeft;
}

// Set the icon margin start
var iconLeft = 'calc(50% - ' + ((textWidth / 2) + 30) + 'px)';
iconEle.style.marginLeft = iconLeft;
if (this._plt.isRTL) {
iconEle.style.marginRight = iconLeft;
} else {
iconEle.style.marginLeft = iconLeft;
}
}
}

Expand All @@ -257,11 +265,19 @@ export class Searchbar extends BaseInput<string> {
var cancelStyle = cancelStyleEle.style;
this._isCancelVisible = showShowCancel;
if (showShowCancel) {
cancelStyle.marginRight = '0';
if (this._plt.isRTL) {
cancelStyle.marginLeft = '0';
} else {
cancelStyle.marginRight = '0';
}
} else {
var offset = cancelStyleEle.offsetWidth;
if (offset > 0) {
cancelStyle.marginRight = -offset + 'px';
if (this._plt.isRTL) {
cancelStyle.marginLeft = -offset + 'px';
} else {
cancelStyle.marginRight = -offset + 'px';
}
}
}
}
Expand Down

0 comments on commit ca71072

Please sign in to comment.