Using after: utility classes to expand <a> to fill entire card.

This was a suggestion adapted from Gemini.
This commit is contained in:
Benjamin A. Shelton 2026-11-25 21:21:37 -07:00
commit 28982b1f81
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01
2 changed files with 9 additions and 7 deletions

View file

@ -44,7 +44,7 @@ const { notes } = Astro.props;
<div id="notes-list"> <div id="notes-list">
<ul>{notes.map((note: CollectionEntry<'notes'>) => ( <ul>{notes.map((note: CollectionEntry<'notes'>) => (
<li class="flex"><a href={new URL(`${base}notes/${note.id}/`, Astro.url).pathname}> <li class="flex">
<div class="header-image"> <div class="header-image">
<img src={urlfrag(base, note.data.post_image)} class="rounded-md" /> <img src={urlfrag(base, note.data.post_image)} class="rounded-md" />
</div> </div>
@ -60,10 +60,10 @@ const { notes } = Astro.props;
</ul> </ul>
</div> </div>
<hgroup> <hgroup>
<h2>{note.data.title}</h2> <h2><a href={new URL(`${base}notes/${note.id}/`, Astro.url).pathname}>{note.data.title}</a></h2>
<h3>{note.data.sub_heading}</h3> <h3>{note.data.sub_heading}</h3>
</hgroup> </hgroup>
<time>{dateFormat(note.data.date)}</time> <time>{dateFormat(note.data.date)}</time>
</a></li> </li>
))}</ul> ))}</ul>
</div> </div>

View file

@ -403,12 +403,14 @@ dialog.scripture {
#notes-list > ul > li { #notes-list > ul > li {
border-width: 1px; border-width: 1px;
border-style: solid; border-style: solid;
@apply flex rounded-xl bg-transparent p-2 hover:bg-gray-100 border-gray-200; @apply flex flex-col relative;
@apply rounded-xl bg-transparent p-2 hover:bg-gray-100 border-gray-200;
@apply focus-within:outline-2 focus-within:outline-offset-8 focus-within:outline-blue-500 focus-within:rounded-2xl;
@apply dark:bg-transparent dark:text-gray-300 dark:border-gray-800 dark:hover:bg-gray-800; @apply dark:bg-transparent dark:text-gray-300 dark:border-gray-800 dark:hover:bg-gray-800;
} }
#notes-list > ul > li > a { #notes-list > ul > li > hgroup > h2 > a {
@apply flex w-full flex-col; @apply after:absolute after:inset-0 group-hover:underline focus:outline-none;
@apply focus-visible:outline-4 focus-visible:outline-offset-8 focus-visible:rounded-2xl; @apply focus-visible:outline-4 focus-visible:outline-offset-8 focus-visible:rounded-2xl;
@apply focus-visible:outline-blue-500; @apply focus-visible:outline-blue-500;
} }
@ -418,7 +420,7 @@ dialog.scripture {
@apply dark:shadow-gray-900; @apply dark:shadow-gray-900;
} }
#notes-list ul > li > a > hgroup { #notes-list ul > li > hgroup {
@apply grow p-4 transition-colors duration-500; @apply grow p-4 transition-colors duration-500;
h2 { h2 {
@apply font-bold text-2xl inline-block; @apply font-bold text-2xl inline-block;