-
-
Notifications
You must be signed in to change notification settings - Fork 433
Expand file tree
/
Copy pathCard.vue
More file actions
63 lines (57 loc) · 1.92 KB
/
Card.vue
File metadata and controls
63 lines (57 loc) · 1.92 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
<script setup lang="ts">
import type { ReleaseData } from '~~/shared/types/changelog'
const { release } = defineProps<{
release: ReleaseData
}>()
const formattedDate = computed(() => {
if (!release.publishedAt) {
return
}
return new Date(release.publishedAt).toISOString().split('T')[0]
})
const cardId = computed(() => (release.publishedAt ? `date-${formattedDate.value}` : undefined))
const navId = computed(() => `release-${encodeURI(release.title)}:`)
function navigateToTitle() {
navigateTo(`#${navId.value}`)
}
</script>
<template>
<section class="border border-border rounded-lg p-4 sm:p-6">
<div class="flex gap-2 items-center" :id="cardId">
<h2 class="text-1xl sm:text-2xl font-medium min-w-0 break-words py-2" :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" />
<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;
}
.linkTitle:hover:after {
@apply opacity-100;
}
</style>