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(NcActionButton): RTL support #6200

Merged
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
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 @@
<!-- 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 @@
<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,17 +382,23 @@
components: {
CheckIcon,
ChevronRightIcon,
ChevronLeftIcon,
},
setup() {
return {
isRTL: isRTL(),
}
},
mixins: [ActionTextMixin],

Check warning on line 392 in src/components/NcActionButton/NcActionButton.vue

View workflow job for this annotation

GitHub Actions / NPM lint

The "mixins" property should be above the "setup" property on line 387

inject: {

Check warning on line 394 in src/components/NcActionButton/NcActionButton.vue

View workflow job for this annotation

GitHub Actions / NPM lint

The "inject" property should be above the "setup" property on line 387
isInSemanticMenu: {
from: 'NcActions:isSemanticMenu',
default: false,
},
},

props: {

Check warning on line 401 in src/components/NcActionButton/NcActionButton.vue

View workflow job for this annotation

GitHub Actions / NPM lint

The "props" property should be above the "setup" property on line 387
/**
* @deprecated To be removed in @nextcloud/vue 9. Migration guide: remove ariaHidden prop from NcAction* components.
* @todo Add a check in @nextcloud/vue 9 that this prop is not provided,
Expand Down Expand Up @@ -547,7 +556,6 @@
@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>
Loading