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 <[email protected]>
  • Loading branch information
hamza221 committed Oct 24, 2024
1 parent aac2eee commit 8a6536c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
10 changes: 8 additions & 2 deletions css/app-navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,19 @@
}
}

&__previous,
&__next {
&__left,
&__right {
background-size: 10px;
flex-grow: 0 !important;
width: 34px;
padding: 0 6px !important;
}
&__left{
border-radius: var(--border-radius-element) 0 0 var(--border-radius-element) !important;
}
&__right{
border-radius: 0 var(--border-radius-element) var(--border-radius-element) 0 !important;
}
}

.app-navigation__body {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
<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="button"
:class="{'datepicker-button-section__right': isRTL , 'datepicker-button-section__left': !isRTL}"
: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 +34,16 @@
: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="button"

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
:class="{'datepicker-button-section__right': !isRTL , 'datepicker-button-section__left': isRTL}"
:name="isRTL? previousLabel: nextLabel"

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
@click="navigateToRightTimeRange"
@shortkey="navigateToRightTimeRange">

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

View check run for this annotation

Codecov / codecov/patch

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

Added line #L43 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 +63,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 { isRTL } from '@nextcloud/l10n'

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

View check run for this annotation

Codecov / codecov/patch

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

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

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

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/AppNavigationHeader/AppNavigationHeaderDatePicker.vue#L96-L97

Added lines #L96 - L97 were not covered by tests
selectedDate() {
if (this.isWidget) {
return getDateFromFirstdayParam(this.widgetStore.widgetDate)
Expand Down Expand Up @@ -145,10 +153,10 @@ export default {
},
},
methods: {
navigateToPreviousTimeRange() {
navigateToLeftTimeRange() {

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

View check run for this annotation

Codecov / codecov/patch

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

Added line #L156 was not covered by tests
return this.navigateTimeRangeByFactor(-1)
},
navigateToNextTimeRange() {
navigateToRightTimeRange() {

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

View check run for this annotation

Codecov / codecov/patch

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

Added line #L159 was not covered by tests
return this.navigateTimeRangeByFactor(1)
},
navigateTimeRangeByFactor(factor) {
Expand Down

0 comments on commit 8a6536c

Please sign in to comment.