Fix lint for two specific components. (#28)

This commit is contained in:
Alessandro Jean 2023-09-08 17:03:32 -03:00 committed by GitHub
parent 18fe3d7044
commit f8a1fecae8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 22 deletions

View File

@ -1,12 +1,13 @@
<script setup lang="ts">
import { computed } from "vue"
import { type DefaultTheme, useData } from "vitepress"
import { data as release } from "../data/release.data"
import { useData } from "vitepress"
import type { DefaultTheme } from "vitepress/theme"
import VPNavBarMenuLink from "vitepress/dist/client/theme-default/components/VPNavBarMenuLink.vue"
import VPNavBarMenuGroup from "vitepress/dist/client/theme-default/components/VPNavBarMenuGroup.vue"
import { data as release } from "../data/release.data"
const { theme } = useData<DefaultTheme.Config>()
/**
@ -21,7 +22,7 @@ const nav = computed(() => {
const appVersion = release.stable.tag_name.substring(1)
return <DefaultTheme.NavItemWithChildren> {
return {
...item,
text: item.text === "{app_version}" ? appVersion : item.text,
items: (item as DefaultTheme.NavItemWithChildren).items.map((child) => {
@ -29,12 +30,12 @@ const nav = computed(() => {
return child
}
return <DefaultTheme.NavItemWithLink> {
return {
...child,
link: child.link.replace("{app_version}", appVersion),
}
} satisfies DefaultTheme.NavItemWithLink
}),
}
} satisfies DefaultTheme.NavItemWithChildren
})
})
</script>

View File

@ -2,11 +2,11 @@
import { computed } from "vue"
import { type DefaultTheme, useData } from "vitepress"
import { data as release } from "../data/release.data"
import VPNavScreenMenuLink from "vitepress/dist/client/theme-default/components/VPNavScreenMenuLink.vue"
import VPNavScreenMenuGroup from "vitepress/dist/client/theme-default/components/VPNavScreenMenuGroup.vue"
import { data as release } from "../data/release.data"
const { theme } = useData<DefaultTheme.Config>()
/**
@ -21,7 +21,7 @@ const nav = computed(() => {
const appVersion = release.stable.tag_name.substring(1)
return <DefaultTheme.NavItemWithChildren> {
return {
...item,
text: item.text === "{app_version}" ? appVersion : item.text,
items: (item as DefaultTheme.NavItemWithChildren).items.map((child) => {
@ -29,12 +29,12 @@ const nav = computed(() => {
return child
}
return <DefaultTheme.NavItemWithLink> {
return {
...child,
link: child.link.replace("{app_version}", appVersion),
}
} satisfies DefaultTheme.NavItemWithLink
}),
}
} satisfies DefaultTheme.NavItemWithChildren
})
})
</script>
@ -42,15 +42,15 @@ const nav = computed(() => {
<template>
<nav v-if="nav" class="VPNavScreenMenu">
<template v-for="item in nav" :key="item.text">
<VPNavScreenMenuLink
v-if="'link' in item"
:item="item"
/>
<VPNavScreenMenuGroup
v-else
:text="item.text || ''"
:items="item.items"
/>
<VPNavScreenMenuLink
v-if="'link' in item"
:item="item"
/>
<VPNavScreenMenuGroup
v-else
:text="item.text || ''"
:items="item.items"
/>
</template>
</nav>
</template>