@happydesigns/ui 0.13.5 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -94
- package/app/app.config.ts +168 -169
- package/app/app.vue +11 -0
- package/app/components/article/ArticleGrid.vue +134 -158
- package/app/components/article/ArticleGridDate.vue +1 -1
- package/app/components/article/ArticleHeaderBody.vue +20 -20
- package/app/components/article/ArticleHeadlineMeta.vue +26 -26
- package/app/components/article/ArticleList.vue +80 -95
- package/app/components/article/ArticlePage.vue +17 -16
- package/app/components/footer/FooterColumnHeading.vue +5 -5
- package/app/components/footer/FooterColumns.vue +16 -20
- package/app/components/footer/FooterCopyright.vue +35 -29
- package/app/components/traits/Authors.vue +21 -20
- package/app/components/traits/BackButton.vue +15 -26
- package/app/components/traits/Category.vue +9 -9
- package/app/components/traits/CopyButton.vue +32 -39
- package/app/components/traits/Dates.vue +20 -20
- package/app/components/traits/Links.vue +17 -17
- package/app/components/traits/Location.vue +20 -20
- package/app/components/traits/Separator.vue +21 -26
- package/app/components/traits/SeparatorButtons.vue +54 -56
- package/app/components/traits/Surround.vue +51 -60
- package/app/components/traits/Toc.vue +16 -16
- package/app/composables/useArticleList.ts +13 -15
- package/app/composables/useArticleListQuery.ts +54 -0
- package/app/composables/useCategoryBadge.ts +27 -27
- package/app/composables/useClipboard.ts +26 -26
- package/app/composables/usePageContent.ts +18 -18
- package/app/composables/usePageSeo.ts +30 -30
- package/app/layouts/article.vue +120 -128
- package/app/layouts/content.vue +59 -67
- package/app/layouts/default.vue +1 -10
- package/app/types/config.ts +13 -6
- package/app/utils/resolveUsers.ts +32 -3
- package/content.config.ts +6 -6
- package/nuxt.config.ts +72 -80
- package/package.json +29 -18
- package/schemas/collections.ts +46 -46
- package/schemas/index.ts +2 -2
- package/schemas/traits.ts +90 -90
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts" generic="T extends FooterColumnLink">
|
|
2
|
-
import type { FooterColumn, FooterColumnLink, FooterColumnsProps, FooterColumnsSlots } from '@nuxt/ui'
|
|
2
|
+
import type { FooterColumn, FooterColumnLink, FooterColumnsProps, FooterColumnsSlots, SlotClass } from '@nuxt/ui'
|
|
3
3
|
import { useAppConfig } from '#imports'
|
|
4
|
-
import { tv } from 'tailwind-variants'
|
|
5
4
|
|
|
6
5
|
interface HFooterColumnProps<T extends FooterColumnLink> extends /* @vue-ignore */ FooterColumnsProps<T> {
|
|
7
6
|
lgCols?: number
|
|
@@ -23,28 +22,25 @@ const rightCount = slots.right ? slots.right({}).length : 0
|
|
|
23
22
|
const lgCount = Math.max(leftCount, centerCount, rightCount)
|
|
24
23
|
const totalCount = leftCount + centerCount + rightCount
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
function withLayoutClass(base: string, override?: SlotClass): SlotClass {
|
|
26
|
+
if (typeof override === 'function')
|
|
27
|
+
return defaults => [base, override(defaults)]
|
|
28
|
+
|
|
29
|
+
return [base, override]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const ui = computed(() => ({
|
|
33
|
+
...props.ui,
|
|
34
|
+
root: withLayoutClass('footer-cols-root all:grid grid-flow-row gap-y-12 gap-x-8', props.ui?.root),
|
|
35
|
+
left: withLayoutClass('footer-cols-left', props.ui?.left),
|
|
36
|
+
center: withLayoutClass('footer-cols-center', props.ui?.center),
|
|
37
|
+
right: withLayoutClass('footer-cols-right', props.ui?.right),
|
|
38
|
+
}))
|
|
38
39
|
</script>
|
|
39
40
|
|
|
40
41
|
<template>
|
|
41
42
|
<UFooterColumns
|
|
42
|
-
v-bind="props" :columns="footerColumns" :ui="
|
|
43
|
-
root: ui.root?.() ?? '',
|
|
44
|
-
left: ui.left?.() ?? '',
|
|
45
|
-
center: ui.center?.() ?? '',
|
|
46
|
-
right: ui.right?.() ?? '',
|
|
47
|
-
}"
|
|
43
|
+
v-bind="props" :columns="footerColumns" :ui="ui"
|
|
48
44
|
:style="{
|
|
49
45
|
'--cols-sm': 1,
|
|
50
46
|
'--cols-lg': props.lgCols ?? lgCount,
|
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
const props = defineProps<{
|
|
3
|
-
copyrightYear?: number
|
|
4
|
-
copyrightHolder?: string
|
|
5
|
-
copyrightHomepage?: string
|
|
6
|
-
}>()
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = defineProps<{
|
|
3
|
+
copyrightYear?: number
|
|
4
|
+
copyrightHolder?: string
|
|
5
|
+
copyrightHomepage?: string
|
|
6
|
+
}>()
|
|
7
|
+
|
|
8
|
+
interface CopyrightConfig {
|
|
9
|
+
copyrightHolder?: string
|
|
10
|
+
copyrightHomepage?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const appConfig = useAppConfig()
|
|
14
|
+
const copyright = appConfig.app?.meta?.copyright as CopyrightConfig | undefined
|
|
15
|
+
|
|
16
|
+
const copyrightYear = props.copyrightYear ?? new Date().getFullYear()
|
|
17
|
+
const copyrightHolder = props.copyrightHolder ?? copyright?.copyrightHolder ?? ''
|
|
18
|
+
const copyrightHomepage = props.copyrightHomepage ?? copyright?.copyrightHomepage ?? ''
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<div>
|
|
23
|
+
<template v-if="$slots.copyright">
|
|
24
|
+
<slot name="copyright" :copyright-year :copyright-homepage :copyright-holder />
|
|
25
|
+
</template>
|
|
26
|
+
<template v-else>
|
|
27
|
+
<p class="text-muted text-sm">
|
|
28
|
+
Copyright © {{ copyrightYear }}
|
|
29
|
+
<ULink :to="copyrightHomepage" target="_blank">
|
|
30
|
+
{{ copyrightHolder }}
|
|
31
|
+
</ULink>
|
|
32
|
+
</p>
|
|
33
|
+
</template>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { UserProps } from '@nuxt/ui'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
authors?: string[]
|
|
6
|
+
target?: string
|
|
7
|
+
config?: { user?: Partial<UserProps> }
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const userProps = computed(() => ({ ...(props.config?.user ?? {}), ...(props.target ? { target: props.target } : {}) }))
|
|
11
|
+
|
|
12
|
+
const resolvedAuthors = await resolveUsers(props.authors || [], userProps.value)
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<UUser
|
|
17
|
+
v-for="(author, index) in resolvedAuthors"
|
|
18
|
+
:key="index"
|
|
19
|
+
v-bind="author"
|
|
20
|
+
/>
|
|
21
|
+
</template>
|
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { RouteLocationRaw } from 'vue-router'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
to?: RouteLocationRaw
|
|
6
|
-
icon?: string
|
|
7
|
-
label?: string
|
|
8
|
-
}>()
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
</
|
|
16
|
-
|
|
17
|
-
<template>
|
|
18
|
-
<UButton
|
|
19
|
-
color="primary"
|
|
20
|
-
variant="ghost"
|
|
21
|
-
:icon="resolvedIcon"
|
|
22
|
-
:to="resolvedTo"
|
|
23
|
-
>
|
|
24
|
-
{{ resolvedLabel }}
|
|
25
|
-
</UButton>
|
|
26
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { RouteLocationRaw } from 'vue-router'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
to?: RouteLocationRaw
|
|
6
|
+
icon?: string
|
|
7
|
+
label?: string
|
|
8
|
+
}>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<UButton color="primary" variant="ghost" :icon="icon" :to="to">
|
|
13
|
+
{{ label }}
|
|
14
|
+
</UButton>
|
|
15
|
+
</template>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
defineProps<{
|
|
3
|
-
category?: string
|
|
4
|
-
}>()
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<template>
|
|
8
|
-
<span class="text-primary-500 dark:text-primary-400 font-medium">{{ category }}</span>
|
|
9
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
category?: string
|
|
4
|
+
}>()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<span class="text-primary-500 dark:text-primary-400 font-medium">{{ category }}</span>
|
|
9
|
+
</template>
|
|
@@ -1,39 +1,32 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
const props = defineProps<{
|
|
3
|
-
path?: string
|
|
4
|
-
icon?: string
|
|
5
|
-
label?: string
|
|
6
|
-
successIcon?: string
|
|
7
|
-
successLabel?: string
|
|
8
|
-
}>()
|
|
9
|
-
|
|
10
|
-
const {
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
icon
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
variant="ghost"
|
|
34
|
-
color="neutral"
|
|
35
|
-
@click="copyLink"
|
|
36
|
-
>
|
|
37
|
-
{{ resolvedLabel }}
|
|
38
|
-
</UButton>
|
|
39
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = defineProps<{
|
|
3
|
+
path?: string
|
|
4
|
+
icon?: string
|
|
5
|
+
label?: string
|
|
6
|
+
successIcon?: string
|
|
7
|
+
successLabel?: string
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const { copy } = useClipboard()
|
|
11
|
+
const url = useRequestURL()
|
|
12
|
+
const route = useRoute()
|
|
13
|
+
|
|
14
|
+
function copyLink() {
|
|
15
|
+
copy(`${url.origin}${props.path ?? route.path}`, {
|
|
16
|
+
id: 'article-copy-link',
|
|
17
|
+
title: props.successLabel,
|
|
18
|
+
icon: props.successIcon,
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<UButton
|
|
25
|
+
:icon="icon"
|
|
26
|
+
variant="ghost"
|
|
27
|
+
color="neutral"
|
|
28
|
+
@click="copyLink"
|
|
29
|
+
>
|
|
30
|
+
{{ label }}
|
|
31
|
+
</UButton>
|
|
32
|
+
</template>
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import formatDate from '
|
|
3
|
-
|
|
4
|
-
defineProps<{
|
|
5
|
-
date?: string
|
|
6
|
-
dateEnd?: string
|
|
7
|
-
}>()
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<div class="all:flex items-center space-x-2">
|
|
12
|
-
<UIcon name="i-lucide-calendar" class="size-4" />
|
|
13
|
-
<time>
|
|
14
|
-
{{ formatDate(date) }}
|
|
15
|
-
<template v-if="dateEnd && date !== dateEnd">
|
|
16
|
-
- {{ formatDate(dateEnd) }}
|
|
17
|
-
</template>
|
|
18
|
-
</time>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import formatDate from '../../utils/formatDate'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
date?: string
|
|
6
|
+
dateEnd?: string
|
|
7
|
+
}>()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div class="all:flex items-center space-x-2">
|
|
12
|
+
<UIcon name="i-lucide-calendar" class="size-4" />
|
|
13
|
+
<time>
|
|
14
|
+
{{ formatDate(date) }}
|
|
15
|
+
<template v-if="dateEnd && date !== dateEnd">
|
|
16
|
+
- {{ formatDate(dateEnd) }}
|
|
17
|
+
</template>
|
|
18
|
+
</time>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { ButtonProps } from '@nuxt/ui'
|
|
3
|
-
|
|
4
|
-
defineProps<{
|
|
5
|
-
links?: ButtonProps[]
|
|
6
|
-
}>()
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<template>
|
|
10
|
-
<UButton
|
|
11
|
-
v-for="(link, index) in links"
|
|
12
|
-
:key="index"
|
|
13
|
-
variant="subtle"
|
|
14
|
-
size="sm"
|
|
15
|
-
v-bind="link"
|
|
16
|
-
/>
|
|
17
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ButtonProps } from '@nuxt/ui'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
links?: ButtonProps[]
|
|
6
|
+
}>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<UButton
|
|
11
|
+
v-for="(link, index) in links"
|
|
12
|
+
:key="index"
|
|
13
|
+
variant="subtle"
|
|
14
|
+
size="sm"
|
|
15
|
+
v-bind="link"
|
|
16
|
+
/>
|
|
17
|
+
</template>
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
defineProps<{
|
|
3
|
-
location?: { url?: string, name?: string }
|
|
4
|
-
}>()
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<template>
|
|
8
|
-
<div class="all:flex items-center space-x-2">
|
|
9
|
-
<UIcon name="i-lucide-map-pin" class="size-4" />
|
|
10
|
-
<NuxtLink
|
|
11
|
-
v-if="location?.url"
|
|
12
|
-
:to="location.url"
|
|
13
|
-
target="_blank"
|
|
14
|
-
class="hover:text-primary transition-colors underline decoration-dotted underline-offset-4"
|
|
15
|
-
>
|
|
16
|
-
{{ location.name }}
|
|
17
|
-
</NuxtLink>
|
|
18
|
-
<span v-else>{{ location?.name }}</span>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
location?: { url?: string, name?: string }
|
|
4
|
+
}>()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<div class="all:flex items-center space-x-2">
|
|
9
|
+
<UIcon name="i-lucide-map-pin" class="size-4" />
|
|
10
|
+
<NuxtLink
|
|
11
|
+
v-if="location?.url"
|
|
12
|
+
:to="location.url"
|
|
13
|
+
target="_blank"
|
|
14
|
+
class="hover:text-primary transition-colors underline decoration-dotted underline-offset-4"
|
|
15
|
+
>
|
|
16
|
+
{{ location.name }}
|
|
17
|
+
</NuxtLink>
|
|
18
|
+
<span v-else>{{ location?.name }}</span>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { ActionButton } from '
|
|
3
|
-
|
|
4
|
-
const props = defineProps<{
|
|
5
|
-
stem?: string
|
|
6
|
-
extension?: string
|
|
7
|
-
buttons?: ActionButton[]
|
|
8
|
-
separator?: string
|
|
9
|
-
}>()
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<div class="all:flex items-center gap-2 text-sm text-muted">
|
|
23
|
-
<HSeparatorButtons :stem="stem" :extension="extension" :buttons="resolvedButtons" :separator="resolvedSeparator" />
|
|
24
|
-
</div>
|
|
25
|
-
</USeparator>
|
|
26
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ActionButton } from '../../types/config'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
stem?: string
|
|
6
|
+
extension?: string
|
|
7
|
+
buttons?: ActionButton[]
|
|
8
|
+
separator?: string
|
|
9
|
+
}>()
|
|
10
|
+
|
|
11
|
+
const hasButtons = computed(() => (props.buttons?.length ?? 0) > 0)
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<USeparator v-if="!hasButtons" class="mt-8" />
|
|
16
|
+
<USeparator v-else class="mt-8">
|
|
17
|
+
<div class="all:flex items-center gap-2 text-sm text-muted">
|
|
18
|
+
<HSeparatorButtons :stem="stem" :extension="extension" :buttons="buttons" :separator="separator" />
|
|
19
|
+
</div>
|
|
20
|
+
</USeparator>
|
|
21
|
+
</template>
|
|
@@ -1,56 +1,54 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { ActionButton } from '
|
|
3
|
-
|
|
4
|
-
const props = defineProps<{
|
|
5
|
-
stem?: string
|
|
6
|
-
extension?: string
|
|
7
|
-
buttons?: ActionButton[]
|
|
8
|
-
separator?: string
|
|
9
|
-
}>()
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
to =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<template>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
</template>
|
|
56
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ActionButton } from '../../types/config'
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(defineProps<{
|
|
5
|
+
stem?: string
|
|
6
|
+
extension?: string
|
|
7
|
+
buttons?: ActionButton[]
|
|
8
|
+
separator?: string
|
|
9
|
+
}>(), {
|
|
10
|
+
buttons: () => [],
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const appConfig = useAppConfig()
|
|
14
|
+
|
|
15
|
+
const editLink = computed(() => {
|
|
16
|
+
const { repo, branch, dir } = appConfig.app.meta.github || {}
|
|
17
|
+
if (!repo || !props.stem)
|
|
18
|
+
return null
|
|
19
|
+
|
|
20
|
+
const extension = props.extension || 'md'
|
|
21
|
+
return `https://github.com/${repo}/edit/${branch}/${dir}/${props.stem}.${extension}`
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const reportLink = computed(() => {
|
|
25
|
+
const repo = appConfig.app.meta.github?.repo
|
|
26
|
+
return repo ? `https://github.com/${repo}/issues/new` : null
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const buttons = computed(() =>
|
|
30
|
+
props.buttons.flatMap((btn) => {
|
|
31
|
+
const { action, ...buttonProps } = btn
|
|
32
|
+
let to = buttonProps.to
|
|
33
|
+
if (action === 'github-edit')
|
|
34
|
+
to = editLink.value ?? undefined
|
|
35
|
+
else if (action === 'report-github-issue')
|
|
36
|
+
to = reportLink.value ?? undefined
|
|
37
|
+
return to ? [{ ...buttonProps, to }] : []
|
|
38
|
+
}),
|
|
39
|
+
)
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<template v-for="(btn, index) in buttons" :key="index">
|
|
44
|
+
<template v-if="index > 0">
|
|
45
|
+
{{ separator }}
|
|
46
|
+
</template>
|
|
47
|
+
<UButton
|
|
48
|
+
variant="link"
|
|
49
|
+
color="neutral"
|
|
50
|
+
:ui="{ leadingIcon: 'size-4' }"
|
|
51
|
+
v-bind="btn"
|
|
52
|
+
/>
|
|
53
|
+
</template>
|
|
54
|
+
</template>
|