Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rtl): navigation buttons #6416

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 { 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 @@
...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 @@
},
},
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
Loading