Skip to content

Commit

Permalink
fix(rtl): navigation buttons
Browse files Browse the repository at this point in the history
Signed-off-by: Hamza Mahjoubi <hamzamahjoubi221@gmail.com>
  • Loading branch information
hamza221 committed Oct 11, 2024
1 parent e6d6120 commit 6e1f6ad
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
4 changes: 2 additions & 2 deletions css/app-navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
}
}

&__previous,
&__next {
&__left,
&__right {
background-size: 10px;
flex-grow: 0 !important;
width: 34px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
<template>
<div class="datepicker-button-section">
<NcButton v-if="!isWidget"
v-shortkey="previousShortKeyConf"
:aria-label="previousLabel"
class="datepicker-button-section__previous button"
:name="previousLabel"
@click="navigateToPreviousTimeRange"
@shortkey="navigateToPreviousTimeRange">
v-shortkey="isRTL? nextShortKeyConf : previousShortKeyConf"
:aria-label="isRTL? nextLabel: previousLabel"
class="datepicker-button-section__left button"
:name="isRTL? nextLabel: previousLabel"
@click="navigateToLeftTimeRange"
@shortkey="navigateToLeftTimeRange">
<template #icon>
<ChevronLeftIcon :size="22" />
<ChevronRightIcon v-if="isRTL" :size="22" />
<ChevronLeftIcon v-else :size="22" />
</template>
</NcButton>
<NcButton v-if="!isWidget"
Expand All @@ -32,14 +33,15 @@
:type="view === 'multiMonthYear' ? 'year' : 'date'"
@change="navigateToDate" />
<NcButton v-if="!isWidget"
v-shortkey="nextShortKeyConf"
:aria-label="nextLabel"
class="datepicker-button-section__next button"
:name="nextLabel"
@click="navigateToNextTimeRange"
@shortkey="navigateToNextTimeRange">
v-shortkey="isRTL? previousShortKeyConf : nextShortKeyConf "
:aria-label="isRTL? previousLabel: nextLabel"
class="datepicker-button-section__right button"
:name="isRTL? previousLabel: nextLabel"

Check warning on line 39 in src/components/AppNavigation/AppNavigationHeader/AppNavigationHeaderDatePicker.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/AppNavigationHeader/AppNavigationHeaderDatePicker.vue#L38-L39

Added lines #L38 - L39 were not covered by tests
@click="navigateToRightTimeRange"
@shortkey="navigateToRightTimeRange">

Check warning on line 41 in src/components/AppNavigation/AppNavigationHeader/AppNavigationHeaderDatePicker.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/AppNavigationHeader/AppNavigationHeaderDatePicker.vue#L41

Added line #L41 was not covered by tests
<template #icon>
<ChevronRightIcon :size="22" />
<ChevronLeftIcon v-if="isRTL" :size="22" />
<ChevronRightIcon v-else :size="22" />
</template>
</NcButton>
</div>
Expand All @@ -59,6 +61,7 @@ import ChevronRightIcon from 'vue-material-design-icons/ChevronRight.vue'
import { NcButton } from '@nextcloud/vue'
import useSettingsStore from '../../../store/settings.js'
import useWidgetStore from '../../../store/widget.js'
import { getLanguage, isRTL } from '@nextcloud/l10n'

Check warning on line 64 in src/components/AppNavigation/AppNavigationHeader/AppNavigationHeaderDatePicker.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/AppNavigationHeader/AppNavigationHeaderDatePicker.vue#L64

Added line #L64 was not covered by tests
export default {
name: 'AppNavigationHeaderDatePicker',
Expand Down Expand Up @@ -87,6 +90,9 @@ export default {
...mapState(useSettingsStore, {
locale: 'momentLocale',
}),
isRTL() {

Check warning on line 93 in src/components/AppNavigation/AppNavigationHeader/AppNavigationHeaderDatePicker.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/AppNavigationHeader/AppNavigationHeaderDatePicker.vue#L93

Added line #L93 was not covered by tests
return isRTL(getLanguage())
},

Check warning on line 95 in src/components/AppNavigation/AppNavigationHeader/AppNavigationHeaderDatePicker.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/AppNavigationHeader/AppNavigationHeaderDatePicker.vue#L95

Added line #L95 was not covered by tests
selectedDate() {
if (this.isWidget) {
return getDateFromFirstdayParam(this.widgetStore.widgetDate)
Expand Down Expand Up @@ -145,11 +151,11 @@ export default {
},
},
methods: {
navigateToPreviousTimeRange() {
return this.navigateTimeRangeByFactor(-1)
navigateToLeftTimeRange() {

Check warning on line 154 in src/components/AppNavigation/AppNavigationHeader/AppNavigationHeaderDatePicker.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/AppNavigationHeader/AppNavigationHeaderDatePicker.vue#L154

Added line #L154 was not covered by tests
return this.navigateTimeRangeByFactor(this.isRTL ? 1 : -1)
},
navigateToNextTimeRange() {
return this.navigateTimeRangeByFactor(1)
navigateToRightTimeRange() {
return this.navigateTimeRangeByFactor(this.isRTL ? -1 : 1)
},
navigateTimeRangeByFactor(factor) {
let newDate
Expand Down

0 comments on commit 6e1f6ad

Please sign in to comment.