Skip to content

Commit 5482b52

Browse files
committed
refactor: use NcIconSvgWrapper with directional property where needed
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 7bcc558 commit 5482b52

File tree

3 files changed

+24
-30
lines changed

3 files changed

+24
-30
lines changed

src/components/NcActionButton/NcActionButton.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,12 @@ export default {
355355
<span v-else class="action-button__text">{{ text }}</span>
356356

357357
<!-- right(in LTR) or left(in RTL) arrow icon when there is a sub-menu -->
358-
<ChevronRightIcon v-if="isMenu && !isRtl" :size="20" class="action-button__menu-icon" />
359-
<ChevronLeftIcon v-else-if="isMenu && isRtl" :size="20" class="action-button__menu-icon" />
360-
<CheckIcon v-else-if="isChecked === true" :size="20" class="action-button__pressed-icon" />
358+
<NcIconSvgWrapper v-if="isMenu"
359+
class="action-button__menu-icon"
360+
directional
361+
:path="mdiChevronLeft" />
362+
<NcIconSvgWrapper v-else-if="isChecked" :path="mdiCheck" class="action-button__pressed-icon" />
363+
361364
<span v-else-if="isChecked === false" class="action-button__pressed-icon material-design-icon" />
362365

363366
<!-- fake slot to gather inner text -->
@@ -367,12 +370,10 @@ export default {
367370
</template>
368371

369372
<script>
370-
import CheckIcon from 'vue-material-design-icons/Check.vue'
371-
import ChevronRightIcon from 'vue-material-design-icons/ChevronRight.vue'
372-
import ChevronLeftIcon from 'vue-material-design-icons/ChevronLeft.vue'
373-
import ActionTextMixin from '../../mixins/actionText.js'
374-
import { isRtl } from '../../utils/rtl.ts'
373+
import { mdiCheck, mdiChevronLeft } from '@mdi/js'
375374
import { NC_ACTIONS_IS_SEMANTIC_MENU } from '../NcActions/useNcActions.ts'
375+
import ActionTextMixin from '../../mixins/actionText.js'
376+
import NcIconSvgWrapper from '../NcIconSvgWrapper/NcIconSvgWrapper.vue'
376377

377378
/**
378379
* Button component to be used in Actions
@@ -381,9 +382,7 @@ export default {
381382
name: 'NcActionButton',
382383

383384
components: {
384-
CheckIcon,
385-
ChevronRightIcon,
386-
ChevronLeftIcon,
385+
NcIconSvgWrapper,
387386
},
388387

389388
mixins: [ActionTextMixin],
@@ -464,7 +463,8 @@ export default {
464463

465464
setup() {
466465
return {
467-
isRtl,
466+
mdiCheck,
467+
mdiChevronLeft,
468468
}
469469
},
470470

src/components/NcActionTextEditable/NcActionTextEditable.vue

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,29 +74,25 @@ export default {
7474
<!-- allow the custom font to inject a ::before
7575
not possible on input[type=submit] -->
7676
<label v-show="!disabled" :for="id" class="action-text-editable__label">
77-
<ArrowLeft v-if="isRtl" :size="20" />
78-
<ArrowRight v-else :size="20" />
77+
<NcIconSvgWrapper directional :path="mdiArrowLeft" />
7978
</label>
8079
</form>
8180
</span>
8281
</li>
8382
</template>
8483

8584
<script>
86-
import ActionTextMixin from '../../mixins/actionText.js'
85+
import { mdiArrowLeft } from '@mdi/js'
8786
import { createElementId } from '../../utils/createElementId.ts'
8887

89-
import ArrowLeft from 'vue-material-design-icons/ArrowLeft.vue'
90-
import ArrowRight from 'vue-material-design-icons/ArrowRight.vue'
91-
92-
import { isRtl } from '../../utils/rtl.ts'
88+
import ActionTextMixin from '../../mixins/actionText.js'
89+
import NcIconSvgWrapper from '../NcIconSvgWrapper/index.js'
9390

9491
export default {
9592
name: 'NcActionTextEditable',
9693

9794
components: {
98-
ArrowLeft,
99-
ArrowRight,
95+
NcIconSvgWrapper,
10096
},
10197

10298
mixins: [ActionTextMixin],
@@ -134,7 +130,7 @@ export default {
134130

135131
setup() {
136132
return {
137-
isRtl,
133+
mdiArrowLeft,
138134
}
139135
},
140136

src/components/NcAppContent/NcAppDetailsToggle.vue

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,32 @@
1010
:title
1111
variant="tertiary">
1212
<template #icon>
13-
<ArrowLeft v-if="isRtl" :size="20" />
14-
<ArrowRight v-else :size="20" />
13+
<NcIconSvgWrapper directional :path="mdiArrowLeft" />
1514
</template>
1615
</NcButton>
1716
</template>
1817

1918
<script>
19+
import { mdiArrowLeft } from '@mdi/js'
2020
import { emit } from '@nextcloud/event-bus'
2121
import { useIsMobile } from '../../composables/useIsMobile/index.js'
22-
import { isRtl } from '../../utils/rtl.ts'
2322
import { t } from '../../l10n.js'
2423

25-
import ArrowRight from 'vue-material-design-icons/ArrowRight.vue'
26-
import ArrowLeft from 'vue-material-design-icons/ArrowLeft.vue'
2724
import NcButton from '../NcButton/index.ts'
25+
import NcIconSvgWrapper from '../NcIconSvgWrapper/NcIconSvgWrapper.vue'
2826

2927
export default {
3028
name: 'NcAppDetailsToggle',
3129

3230
components: {
33-
ArrowRight,
34-
ArrowLeft,
3531
NcButton,
32+
NcIconSvgWrapper,
3633
},
34+
3735
setup() {
3836
return {
39-
isRtl,
4037
isMobile: useIsMobile(),
38+
mdiArrowLeft,
4139
}
4240
},
4341

0 commit comments

Comments
 (0)