@@ -3,6 +3,90 @@ const { data: posts } = await useAsyncData('blog-posts', () =>
33 queryCollection (' blog' ).where (' draft' , ' <>' , true ).order (' date' , ' DESC' ).all (),
44)
55
6+ const placeHolder = [' atproto' , ' atproto' ]
7+
8+ // TODO: This should be extracted into a reusable form so search and blog post can both use it
9+ // function scrollToSelectedItem() {
10+ // const pkgIndex = toPackageIndex(unifiedSelectedIndex.value)
11+ // if (pkgIndex !== null) {
12+ // packageListRef.value?.scrollToIndex(pkgIndex)
13+ // }
14+ // }
15+
16+ // function focusSelectedItem() {
17+ // const suggIdx = toSuggestionIndex(unifiedSelectedIndex.value)
18+ // const pkgIdx = toPackageIndex(unifiedSelectedIndex.value)
19+
20+ // nextTick(() => {
21+ // if (suggIdx !== null) {
22+ // const el = document.querySelector<HTMLElement>(`[data-suggestion-index="${suggIdx}"]`)
23+ // el?.focus()
24+ // } else if (pkgIdx !== null) {
25+ // scrollToSelectedItem()
26+ // nextTick(() => {
27+ // const el = document.querySelector<HTMLElement>(`[data-result-index="${pkgIdx}"]`)
28+ // el?.focus()
29+ // })
30+ // }
31+ // })
32+ // }
33+
34+ // function handleResultsKeydown(e: KeyboardEvent) {
35+ // if (totalSelectableCount.value <= 0) return
36+
37+ // const isFromInput = (e.target as HTMLElement).tagName === 'INPUT'
38+
39+ // if (e.key === 'ArrowDown') {
40+ // e.preventDefault()
41+ // userHasNavigated.value = true
42+ // unifiedSelectedIndex.value = clampUnifiedIndex(unifiedSelectedIndex.value + 1)
43+ // if (isFromInput) {
44+ // scrollToSelectedItem()
45+ // } else {
46+ // focusSelectedItem()
47+ // }
48+ // return
49+ // }
50+
51+ // if (e.key === 'ArrowUp') {
52+ // e.preventDefault()
53+ // userHasNavigated.value = true
54+ // unifiedSelectedIndex.value = clampUnifiedIndex(unifiedSelectedIndex.value - 1)
55+ // if (isFromInput) {
56+ // scrollToSelectedItem()
57+ // } else {
58+ // focusSelectedItem()
59+ // }
60+ // return
61+ // }
62+
63+ // if (e.key === 'Enter') {
64+ // if (!resultsMatchQuery.value) return
65+
66+ // const suggIdx = toSuggestionIndex(unifiedSelectedIndex.value)
67+ // const pkgIdx = toPackageIndex(unifiedSelectedIndex.value)
68+
69+ // if (suggIdx !== null) {
70+ // const el = document.querySelector<HTMLElement>(`[data-suggestion-index="${suggIdx}"]`)
71+ // if (el) {
72+ // e.preventDefault()
73+ // el.click()
74+ // }
75+ // } else if (pkgIdx !== null) {
76+ // const el = document.querySelector<HTMLElement>(`[data-result-index="${pkgIdx}"]`)
77+ // if (el) {
78+ // e.preventDefault()
79+ // el.click()
80+ // }
81+ // }
82+ // }
83+ // }
84+
85+ // function handleBlogPostSelect(index: number) {
86+ // // Convert suggestion index to unified index
87+ // unifiedSelectedIndex.value = -(suggestionCount.value - index)
88+ // }
89+
690definePageMeta ({
791 name: ' blog' ,
892 // alias: ['/:path(.*)*'],
@@ -16,18 +100,30 @@ useSeoMeta({
16100
17101<template >
18102 <main class =" container py-8 sm:py-12 w-full" >
19- <header class =" mb-8 pb-8 border-b border-border" >
20- <div class =" " >I AM A MIGHTY HEADER </div >
103+ <header class =" mb-8 pb-8 border-b border-border flex place-content-center text-3xl " >
104+ <div class =" " >blog... </div >
21105 </header >
22106
23107 <article class =" flex flex-col gap-6" >
24- <div v-for =" post in posts" :key =" post.slug" class =" p-4 border border-border rounded-lg" >
25- <h2 class =" text-xl font-semibold" >
26- <NuxtLink :to =" `/blog/${post.slug}`" class =" text-primary hover:underline" >
27- {{ post.title }}
28- </NuxtLink >
29- </h2 >
30- <p class =" text-muted-foreground" >{{ post.excerpt }}</p >
108+ <div v-if =" posts && posts.length > 0" class =" max-w-3xl mx-auto mb-6 space-y-3" >
109+ <BlogPostListCard
110+ v-for =" (post, idx) in posts"
111+ :key =" `${post.author}-${post.title}`"
112+ :author =" post.author || 'Roe'"
113+ :title =" post.title"
114+ :path =" post.slug"
115+ :excerpt =" post.excerpt || post.description || 'No Excerpt Available'"
116+ :topics =" Array.isArray(post.tags) ? post.tags : placeHolder"
117+ :published =" post.date"
118+ :index =" idx"
119+ @focus =" i => console.log('Hovered:', i)"
120+ />
121+ <!-- :selected="toSuggestionIndex(unifiedSelectedIndex) === idx" -->
122+ <!-- :is-exact-match="
123+ (exactMatchType === 'org' && suggestion.type === 'org') ||
124+ (exactMatchType === 'user' && suggestion.type === 'user')
125+ " -->
126+ <!-- @focus="handleBlogPostSelect" -->
31127 </div >
32128 </article >
33129 </main >
0 commit comments