feat(command): add description for settings items

This commit is contained in:
三咲智子 2022-12-30 04:01:31 +08:00
parent fd93462f42
commit 40481c91e8
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
2 changed files with 9 additions and 11 deletions

View file

@ -1,6 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
const props = defineProps<{ const props = defineProps<{
text?: string text?: string
description?: string
icon?: string icon?: string
to: string | Record<string, string> to: string | Record<string, string>
command?: boolean command?: boolean
@ -12,6 +13,7 @@ useCommand({
scope: 'Settings', scope: 'Settings',
name: () => props.text ?? (typeof props.to === 'string' ? props.to as string : props.to.name), name: () => props.text ?? (typeof props.to === 'string' ? props.to as string : props.to.name),
description: () => props.description,
icon: () => props.icon || '', icon: () => props.icon || '',
visible: () => props.command, visible: () => props.command,
@ -49,7 +51,9 @@ useCommand({
</slot> </slot>
</p> </p>
<p v-if="$slots.description" text-sm text-secondary> <p v-if="$slots.description" text-sm text-secondary>
<slot name="description" /> <slot name="description">
{{ description }}
</slot>
</p> </p>
</div> </div>
</div> </div>

View file

@ -10,21 +10,15 @@
command command
icon="i-ri:user-settings-line" icon="i-ri:user-settings-line"
:text="$t('settings.profile.appearance.label')" :text="$t('settings.profile.appearance.label')"
:description="$t('settings.profile.appearance.description')"
to="/settings/profile/appearance" to="/settings/profile/appearance"
> />
<template #description>
{{ $t('settings.profile.appearance.description') }}
</template>
</SettingsNavItem>
<SettingsNavItem <SettingsNavItem
command command
icon="i-ri:hashtag" icon="i-ri:hashtag"
:text="$t('settings.profile.featured_tags.label')" :text="$t('settings.profile.featured_tags.label')"
:description="$t('settings.profile.featured_tags.description')"
to="/settings/profile/featured-tags" to="/settings/profile/featured-tags"
> />
<template #description>
{{ $t('settings.profile.featured_tags.description') }}
</template>
</SettingsNavItem>
</MainContent> </MainContent>
</template> </template>