-
-
Notifications
You must be signed in to change notification settings - Fork 425
Expand file tree
/
Copy pathCard.vue
More file actions
78 lines (72 loc) · 2.18 KB
/
Card.vue
File metadata and controls
78 lines (72 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<script setup lang="ts">
import type { ReleaseData } from '~~/shared/types/changelog'
import { slugify } from '~~/shared/utils/html'
const { release } = defineProps<{
release: ReleaseData
}>()
const formattedDate = computed(() => {
if (!release.publishedAt) {
return
}
return new Date(release.publishedAt).toISOString().split('T')[0]
})
const cardId = computed(() => (formattedDate.value ? `date-${formattedDate.value}` : undefined))
const navId = computed(() => `release-${slugify(release.title)}`)
function navigateToTitle() {
navigateTo(`#${navId.value}`)
}
</script>
<template>
<section
class="border border-border rounded-lg p-4 pt-2 sm:p-6 sm:pt-4 scroll-mt-18"
:id="cardId"
>
<div
class="flex gap-2 items-center sticky z-3 text-2xl p-2 border-border bg-bg top-[--combined-header-height]"
>
<h2
class="text-1xl sm:text-2xl font-medium min-w-0 break-words py-2 scroll-mt-20"
:id="navId"
>
<a
class="hover:decoration-accent hover:text-accent focus-visible:decoration-accent focus-visible:text-accent transition-colors duration-200"
:class="$style.linkTitle"
:href="`#${navId}`"
@click.prevent="navigateToTitle()"
>
{{ release.title }}
</a>
</h2>
<TagStatic v-if="release.prerelease" variant="default" class="h-unset">
{{ $t('changelog.pre_release') }}
</TagStatic>
<TagStatic v-if="release.draft" variant="default" class="h-unset">
{{ $t('changelog.draft') }}
</TagStatic>
<div class="flex-1" aria-hidden="true"></div>
<ReadmeTocDropdown
v-if="release?.toc && release.toc.length > 1"
:toc="release.toc"
class="ms-auto"
/>
<!-- :active-id="activeTocId" -->
</div>
<DateTime
v-if="release.publishedAt"
:datetime="release.publishedAt"
date-style="medium"
class="mb-2 block"
/>
<Readme v-if="release.html" :html="release.html"></Readme>
</section>
</template>
<style module>
.linkTitle::after {
content: '__';
@apply inline i-lucide:link rtl-flip ms-1 opacity-0;
font-size: 0.75em;
}
.linkTitle:hover::after {
@apply opacity-100;
}
</style>