Skip to content

Commit 6bca8d1

Browse files
committed
Turn blog pagination links into visual arrow buttons
The next/previous links on the blog index were small, low-emphasis text links. Restyle them as pill buttons with directional arrows, a subtle border and background, and a hover animation that nudges the button and slides the arrow. Add a test asserting the Next pagination link renders when more pages exist. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012aAC5we9B72tDs5UcXTLVe
1 parent 71d4a4d commit 6bca8d1

2 files changed

Lines changed: 23 additions & 6 deletions

File tree

‎resources/views/blog.blade.php‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,15 @@ class="flex items-center justify-between gap-5 pt-2.5"
157157
@if (! $articles->onFirstPage())
158158
<a
159159
href="{{ $articles->previousPageUrl() }}"
160-
class="inline-block p-1.5 opacity-60 transition duration-200 hover:opacity-100"
160+
class="group inline-flex items-center gap-2 rounded-full border border-black/10 bg-black/[0.02] py-2 pr-4 pl-3 text-sm opacity-80 transition duration-200 hover:-translate-x-0.5 hover:border-black/20 hover:bg-black/5 hover:opacity-100 dark:border-white/10 dark:bg-white/[0.02] dark:hover:border-white/20 dark:hover:bg-white/5"
161161
aria-label="Go to previous page"
162162
rel="prev"
163163
>
164-
<span class="sr-only">Navigate to</span>
165-
Previous
164+
<x-icons.right-arrow
165+
class="size-3.5 shrink-0 -scale-x-100 transition-transform duration-200 group-hover:-translate-x-0.5"
166+
aria-hidden="true"
167+
/>
168+
<span>Previous</span>
166169
</a>
167170
@endif
168171
</div>
@@ -191,12 +194,15 @@ class="inline-block p-1.5 opacity-60 transition duration-200 hover:opacity-100"
191194
@if (! $articles->onLastPage())
192195
<a
193196
href="{{ $articles->nextPageUrl() }}"
194-
class="inline-block p-1.5 opacity-80 transition duration-200 hover:opacity-100"
197+
class="group inline-flex items-center gap-2 rounded-full border border-black/10 bg-black/[0.02] py-2 pr-3 pl-4 text-sm opacity-80 transition duration-200 hover:translate-x-0.5 hover:border-black/20 hover:bg-black/5 hover:opacity-100 dark:border-white/10 dark:bg-white/[0.02] dark:hover:border-white/20 dark:hover:bg-white/5"
195198
aria-label="Go to next page"
196199
rel="next"
197200
>
198-
<span class="sr-only">Navigate to</span>
199-
Next
201+
<span>Next</span>
202+
<x-icons.right-arrow
203+
class="size-3.5 shrink-0 transition-transform duration-200 group-hover:translate-x-0.5"
204+
aria-hidden="true"
205+
/>
200206
</a>
201207
@endif
202208
</div>

‎tests/Feature/BlogTest.php‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ public function published_articles_are_shown_in_antichronological_order()
4848
]);
4949
}
5050

51+
#[Test]
52+
public function the_blog_listing_renders_a_next_pagination_button_when_there_are_more_pages()
53+
{
54+
Article::factory()->count(7)->published()->create();
55+
56+
$this->get(route('blog'))
57+
->assertOk()
58+
->assertSee('Next')
59+
->assertSee('page=2');
60+
}
61+
5162
#[Test]
5263
public function scheduled_articles_are_not_shown_on_the_blog_listing()
5364
{

0 commit comments

Comments
 (0)