mirror of
https://github.com/versia-pub/frontend.git
synced 2026-03-13 03:29:16 +01:00
refactor: ♻️ Simplify settings page rendering code
This commit is contained in:
parent
50d5af7e4a
commit
733a51ab9a
5 changed files with 23 additions and 16 deletions
18
components/settings/page.vue
Normal file
18
components/settings/page.vue
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<template>
|
||||
<Renderer :id="id" v-for="id of settingsIds" :key="id" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
type SettingIds,
|
||||
type SettingPages,
|
||||
getSettingsForPage,
|
||||
} from "~/settings";
|
||||
import Renderer from "./renderer.vue";
|
||||
|
||||
const props = defineProps<{
|
||||
page: SettingPages;
|
||||
}>();
|
||||
|
||||
const settingsIds = Object.keys(getSettingsForPage(props.page)) as SettingIds[];
|
||||
</script>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
<Tabs.Root v-model="tab" class="bg-dark-700 h-full overflow-auto pb-20">
|
||||
<Tabs.List class="flex flex-row p-4 gap-4 bg-dark-800 relative ring-1 ring-white/5 overflow-x-auto">
|
||||
<Tabs.Trigger :value="page"
|
||||
v-for="page of [SettingPages.Account, SettingPages.Emojis, SettingPages.Behaviour, SettingPages.Appearance]"
|
||||
v-for="page of SettingPages"
|
||||
:as-child="true">
|
||||
<ButtonBase class="capitalize hover:bg-white/5">
|
||||
{{ page }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue