Skip to content

Commit 0cb2ed2

Browse files
committed
feat: add icons support for options in SettingView
1 parent 35f6271 commit 0cb2ed2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

adminforth/modules/codeInjector.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,11 @@ class CodeInjector implements ICodeInjector {
327327
if (!settingPage) {
328328
return;
329329
}
330-
console.log('🪲⚙️ registerSettingPages', settingPage);
330+
for (const page of settingPage) {
331+
if (page.icon) {
332+
icons.push(page.icon);
333+
}
334+
}
331335
}
332336

333337
registerCustomPages(this.adminforth.config);

adminforth/spa/src/views/SettingsView.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@
7676
</div>
7777
<VerticalTabs v-else>
7878
<template v-for="(c,i) in coreStore?.config?.settingPages" :key="`tab:${settingPageSlotName(c,i)}`" v-slot:['tab:'+settingPageSlotName(c,i)]>
79-
<div class="flex items-center justify-center whitespace-nowrap px-4 mx-4">
79+
<div class="flex items-center justify-center whitespace-nowrap px-4 mx-4 gap-2">
80+
<component v-if="c.icon" :is="getIcon(c.icon)" class="w-5 h-5 group-hover:text-lightSidebarIconsHover transition duration-75 dark:group-hover:text-darkSidebarIconsHover dark:text-darkSidebarIcons" ></component>
8081
{{ c.pageLabel }}
8182
</div>
8283
</template>
@@ -97,7 +98,7 @@ import { computed, ref, onMounted, watch } from 'vue';
9798
import { useRouter } from 'vue-router';
9899
import { useCoreStore } from '@/stores/core';
99100
import { useUserStore } from '@/stores/user';
100-
import { getCustomComponent } from '@/utils';
101+
import { getCustomComponent, getIcon } from '@/utils';
101102
import { Dropdown } from 'flowbite';
102103
import { IconMoonSolid, IconSunSolid } from '@iconify-prerendered/vue-flowbite';
103104
import adminforth from '@/adminforth';

0 commit comments

Comments
 (0)