Skip to content

Commit

Permalink
Merge pull request #6200 from falghamdi125/fix-ncaction-button-paddin…
Browse files Browse the repository at this point in the history
…g-in-rtl

fix(NcActionButton): RTL support
  • Loading branch information
nickvergessen authored Dec 20, 2024
2 parents b804306 + cf3af9d commit 99dc74b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
8 changes: 2 additions & 6 deletions src/assets/action.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
height: auto;
margin: 0;
padding: 0;
padding-right: $icon-margin;
padding-inline-end: $icon-margin;
box-sizing: border-box; // otherwise router-link overflows in Firefox

cursor: pointer;
Expand Down Expand Up @@ -109,11 +109,7 @@
}

&__menu-icon {
// Push to the right
margin-left: auto;
// Align with right end of the button
// This is the padding-right
margin-right: calc($icon-margin * -1);
margin-inline: auto calc($icon-margin * -1);
}
}
}
16 changes: 12 additions & 4 deletions src/components/NcActionButton/NcActionButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,9 @@ export default {
<!-- default text display -->
<span v-else class="action-button__text">{{ text }}</span>

<!-- right arrow icon when there is a sub-menu -->
<ChevronRightIcon v-if="isMenu" :size="20" class="action-button__menu-icon" />
<!-- right(in LTR) or left(in RTL) arrow icon when there is a sub-menu -->
<ChevronRightIcon v-if="isMenu && !isRTL" :size="20" class="action-button__menu-icon" />
<ChevronLeftIcon v-else-if="isMenu && isRTL" :size="20" class="action-button__menu-icon" />
<CheckIcon v-else-if="isChecked === true" :size="20" class="action-button__pressed-icon" />
<span v-else-if="isChecked === false" class="action-button__pressed-icon material-design-icon" />

Expand All @@ -368,7 +369,9 @@ export default {
<script>
import CheckIcon from 'vue-material-design-icons/Check.vue'
import ChevronRightIcon from 'vue-material-design-icons/ChevronRight.vue'
import ChevronLeftIcon from 'vue-material-design-icons/ChevronLeft.vue'
import ActionTextMixin from '../../mixins/actionText.js'
import { isRTL } from '@nextcloud/l10n'

/**
* Button component to be used in Actions
Expand All @@ -379,6 +382,12 @@ export default {
components: {
CheckIcon,
ChevronRightIcon,
ChevronLeftIcon,
},
setup() {
return {
isRTL: isRTL(),
}
},
mixins: [ActionTextMixin],

Expand Down Expand Up @@ -547,7 +556,6 @@ export default {
@include action-item('button');

.action-button__pressed-icon {
margin-left: auto;
margin-right: calc($icon-margin * -1);
margin-inline: auto calc($icon-margin * -1);
}
</style>

0 comments on commit 99dc74b

Please sign in to comment.