Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .vitepress/theme/BlogIndex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Rss } from 'lucide-vue-next'
import { data as posts } from '../../blog/posts.data'

const selectedTag = ref(null)
const tagsOpen = ref(false)
const page = ref(1)
const perPage = 10

Expand Down Expand Up @@ -60,20 +61,18 @@ onMounted(() => {
if (tagParam && allTags.value.includes(tagParam)) {
selectedTag.value = tagParam
}
if (window.innerWidth > 640) {
document.querySelector('.blog-tags-details')?.setAttribute('open', '')
}
})
</script>

<template>
<div class="blog-index">
<div class="blog-tags-row">
<details class="blog-tags-details">
<summary class="blog-tags-summary">
<div class="blog-tags-collapsible">
<button class="blog-tags-toggle" @click="tagsOpen = !tagsOpen" :aria-expanded="tagsOpen">
Filter by tag<span v-if="selectedTag" class="blog-tags-active-indicator">: {{ selectedTag }}</span>
</summary>
<div class="blog-tags" v-if="allTags.length" role="group" aria-label="Filter by tag">
<span class="blog-tags-arrow" :class="{ open: tagsOpen }">▸</span>
</button>
<div class="blog-tags" v-show="tagsOpen" v-if="allTags.length" role="group" aria-label="Filter by tag">
<button
:class="{ active: !selectedTag }"
:aria-pressed="!selectedTag"
Expand All @@ -86,7 +85,7 @@ onMounted(() => {
@click="selectTag(tag)"
>{{ tag }} ({{ tagCounts[tag] }})</button>
</div>
</details>
</div>
<a href="/feed.xml" class="blog-rss-link" aria-label="Subscribe via RSS">
<Rss :size="14" style="margin-right:4px" />
RSS
Expand Down
19 changes: 8 additions & 11 deletions .vitepress/theme/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -121,36 +121,33 @@
}

/* ── Blog tags collapsible ── */
.blog-tags-details {
.blog-tags-collapsible {
flex: 1;
min-width: 0;
}

.blog-tags-details summary {
.blog-tags-toggle {
cursor: pointer;
list-style: none;
background: none;
border: none;
padding: 0;
font-size: 14px;
font-weight: 500;
color: var(--vp-c-text-2);
}

.blog-tags-details summary::-webkit-details-marker {
display: none;
}

.blog-tags-details summary::after {
content: '▸';
.blog-tags-arrow {
margin-left: 6px;
font-size: 12px;
transition: transform 0.2s;
display: inline-block;
}

.blog-tags-details[open] summary::after {
.blog-tags-arrow.open {
transform: rotate(90deg);
}

.blog-tags-details[open] .blog-tags {
.blog-tags-collapsible .blog-tags {
margin-top: 12px;
}

Expand Down
Loading