Skip to content

Commit bb1c9d1

Browse files
refactor(recently-created-icon): use mdi/js path instead of raw svg prop setup() instead of data()
Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
1 parent bcfe3c9 commit bb1c9d1

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

apps/files/src/components/FileEntry/RecentlyCreatedIcon.vue

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
55
<template>
6-
<NcIconSvgWrapper class="recently-created-marker-icon" :name="t('files', 'Recently created')" :svg="PlusSvg" />
6+
<NcIconSvgWrapper class="recently-created-marker-icon" :name="t('files', 'Recently created')" :path="mdiPlus" />
77
</template>
88

99
<script lang="ts">
10-
import PlusSvg from '@mdi/svg/svg/plus.svg?raw'
11-
import { translate as t } from '@nextcloud/l10n'
10+
import { mdiPlus } from '@mdi/js'
11+
import { t } from '@nextcloud/l10n'
1212
import { defineComponent } from 'vue'
1313
import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
1414
@@ -18,7 +18,7 @@ import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
1818
*
1919
* If the background has a hover state you might want to also apply it to the stroke like this:
2020
* ```scss
21-
* .parent:hover :deep(.favorite-marker-icon svg path) {
21+
* .parent:hover :deep(.recently-created-marker-icon svg path) {
2222
* stroke: var(--color-background-hover);
2323
* }
2424
* ```
@@ -29,19 +29,12 @@ export default defineComponent({
2929
NcIconSvgWrapper,
3030
},
3131
32-
data() {
32+
setup() {
3333
return {
34-
PlusSvg,
34+
mdiPlus,
3535
}
3636
},
3737
38-
async mounted() {
39-
await this.$nextTick()
40-
// MDI default viewBox is "0 0 24 24" but we add a stroke of 10px so we must adjust it
41-
const el = this.$el.querySelector('svg')
42-
el?.setAttribute?.('viewBox', '-4 -4 30 30')
43-
},
44-
4538
methods: {
4639
t,
4740
},

0 commit comments

Comments
 (0)