Skip to content

Commit

Permalink
Simplify left/right arrow display logic
Browse files Browse the repository at this point in the history
Leverage the icons being flipped rather than manually setting the classes to their opposites when the directionality is RTL.
  • Loading branch information
kommunarr committed Aug 29, 2023
1 parent 03648af commit a16c7f7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
6 changes: 0 additions & 6 deletions src/renderer/components/top-nav/top-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ export default defineComponent({
return this.$store.getters.getCurrentLocale
},

isLocaleRightToLeft: function() {
const locale = this.$i18n.locale.replace('_', '-')
return locale === 'ar' || locale === 'fa' || locale === 'he' ||
locale === 'ur' || locale === 'yi' || locale === 'ku'
},

backendFallback: function () {
return this.$store.getters.getBackendFallback
},
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/top-nav/top-nav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
:aria-disabled="isArrowBackwardDisabled"
class="navIcon"
:class="{ arrowBackwardDisabled: isArrowBackwardDisabled}"
:icon="['fas', !isLocaleRightToLeft ? 'arrow-left' : 'arrow-right']"
:icon="['fas', 'arrow-left']"
role="button"
tabindex="0"
:title="backwardText"
Expand All @@ -28,7 +28,7 @@
:aria-disabled="isArrowForwardDisabled"
class="navIcon"
:class="{ arrowForwardDisabled: isArrowForwardDisabled}"
:icon="['fas', !isLocaleRightToLeft ? 'arrow-right' : 'arrow-left']"
:icon="['fas', 'arrow-right']"
role="button"
tabindex="0"
:title="forwardText"
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/themes.css
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ body[dir='rtl'] {
--horizontal-directionality-coefficient: -1;
}

body[dir='rtl'] [data-prefix="fas"]:not([data-icon="arrow-left"]):not([data-icon="arrow-right"]):not([data-icon="magnifying-glass"]):not([data-icon="circle-question"]) {
body[dir='rtl'] [data-prefix="fas"]:not([data-icon="magnifying-glass"]):not([data-icon="circle-question"]) {
transform: scale(-1,1);
}

Expand Down

0 comments on commit a16c7f7

Please sign in to comment.