Skip to content

Commit 9f9195d

Browse files
committed
release card header links can now also be clicked to navigate to
1 parent 95e3699 commit 9f9195d

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

app/components/Changelog/Card.vue

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,23 @@ const formattedDate = useDateFormat(() => release.publishedAt, 'YYYY-MM-DD', {})
1010
const cardId = computed(() => (release.publishedAt ? `date-${formattedDate.value}` : undefined))
1111
1212
const navId = computed(() => `releaae-${encodeURIComponent(release.title)}`)
13+
14+
function navigateToTitle() {
15+
navigateTo(`#${navId.value}`)
16+
}
1317
</script>
1418
<template>
1519
<section class="border border-border rounded-lg p-4 sm:p-6">
1620
<div class="flex justify-between" :id="cardId">
1721
<h2 class="text-1xl sm:text-2xl font-medium min-w-0 break-words py-2" :id="navId">
18-
{{ release.title }}
22+
<a
23+
class="hover:decoration-accent hover:text-accent focus-visible:decoration-accent focus-visible:text-accent transition-colors duration-200"
24+
:class="$style.linkTitle"
25+
:href="`#${navId}`"
26+
@click.prevent="navigateToTitle()"
27+
>
28+
{{ release.title }}
29+
</a>
1930
</h2>
2031
<ReadmeTocDropdown
2132
v-if="release?.toc && release.toc.length > 1"
@@ -28,4 +39,13 @@ const navId = computed(() => `releaae-${encodeURIComponent(release.title)}`)
2839
</section>
2940
</template>
3041

31-
<!-- class="group bg-bg-subtle border border-border rounded-lg p-4 sm:p-6 transition-[border-color,background-color] duration-200 hover:(border-border-hover bg-bg-muted) cursor-pointer relative focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-bg focus-within:ring-offset-2 focus-within:ring-fg/50 focus-within:bg-bg-muted focus-within:border-border-hover" -->
42+
<style module>
43+
.linkTitle::after {
44+
content: '__';
45+
@apply inline i-lucide:link rtl-flip ms-1 opacity-0;
46+
}
47+
48+
.linkTitle:hover:after {
49+
@apply opacity-100;
50+
}
51+
</style>

0 commit comments

Comments
 (0)