Skip to content

Commit 163de5e

Browse files
scott graysonscott grayson
authored andcommitted
Restore custom pagination and dark mode support
- Recreate custom pagination component with dark mode styling - Restore all dark: utility classes to public views - Restore dark mode in layout (bg-gray-900, bg-gray-800) - Update index to use custom pagination component - Better UI consistency and polish
1 parent 626ef87 commit 163de5e

File tree

4 files changed

+128
-21
lines changed

4 files changed

+128
-21
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
@if ($paginator->hasPages())
2+
<nav role="navigation" aria-label="Pagination Navigation" class="flex items-center justify-between w-full">
3+
<div class="flex justify-between flex-1 sm:hidden">
4+
@if ($paginator->onFirstPage())
5+
<span class="relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 rounded-md dark:text-gray-400 dark:bg-gray-800 dark:border-gray-600">
6+
{!! __('pagination.previous') !!}
7+
</span>
8+
@else
9+
<a href="{{ $paginator->previousPageUrl() }}" class="relative inline-flex items-center px-4 py-2 ml-3 text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-500 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300 dark:focus:border-blue-700 dark:active:bg-gray-700 dark:active:text-gray-300">
10+
{!! __('pagination.previous') !!}
11+
</a>
12+
@endif
13+
14+
@if ($paginator->hasMorePages())
15+
<a href="{{ $paginator->nextPageUrl() }}" class="relative inline-flex items-center px-4 py-2 ml-3 text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-500 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300 dark:focus:border-blue-700 dark:active:bg-gray-700 dark:active:text-gray-300">
16+
{!! __('pagination.next') !!}
17+
</a>
18+
@else
19+
<span class="relative inline-flex items-center px-4 py-2 ml-3 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 rounded-md dark:text-gray-400 dark:bg-gray-800 dark:border-gray-600">
20+
{!! __('pagination.next') !!}
21+
</span>
22+
@endif
23+
</div>
24+
25+
<div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between sm:w-full">
26+
<div class="hidden sm:block flex-shrink-0">
27+
<p class="text-sm text-gray-700 leading-5 dark:text-gray-400">
28+
{!! __('Showing') !!}
29+
@if ($paginator->firstItem())
30+
<span class="font-medium">{{ $paginator->firstItem() }}</span>
31+
{!! __('to') !!}
32+
<span class="font-medium">{{ $paginator->lastItem() }}</span>
33+
@else
34+
{{ $paginator->count() }}
35+
@endif
36+
{!! __('of') !!}
37+
<span class="font-medium">{{ $paginator->total() }}</span>
38+
{!! __('results') !!}
39+
</p>
40+
</div>
41+
42+
<div class="flex-shrink-0 ml-auto">
43+
<span class="relative z-0 inline-flex rtl:flex-row-reverse shadow-sm rounded-md">
44+
{{-- Previous Page Link --}}
45+
@if ($paginator->onFirstPage())
46+
<span aria-disabled="true" aria-label="{{ __('pagination.previous') }}">
47+
<span class="relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default rounded-l-md leading-5 dark:bg-gray-800 dark:border-gray-600" aria-hidden="true">
48+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
49+
<path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" />
50+
</svg>
51+
</span>
52+
</span>
53+
@else
54+
<a href="{{ $paginator->previousPageUrl() }}" rel="prev" class="relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-l-md leading-5 hover:text-gray-400 focus:z-10 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-500 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:active:bg-gray-700 dark:focus:border-blue-800" aria-label="{{ __('pagination.previous') }}">
55+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
56+
<path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" />
57+
</svg>
58+
</a>
59+
@endif
60+
61+
{{-- Pagination Elements --}}
62+
@foreach ($elements as $element)
63+
{{-- "Three Dots" Separator --}}
64+
@if (is_string($element))
65+
<span aria-disabled="true">
66+
<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-400">{{ $element }}</span>
67+
</span>
68+
@endif
69+
70+
{{-- Array Of Links --}}
71+
@if (is_array($element))
72+
@foreach ($element as $page => $url)
73+
@if ($page == $paginator->currentPage())
74+
<span aria-current="page">
75+
<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">{{ $page }}</span>
76+
</span>
77+
@else
78+
<a href="{{ $url }}" class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 hover:text-gray-500 focus:z-10 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-400 dark:hover:text-gray-300 dark:active:bg-gray-700 dark:focus:border-blue-800" aria-label="{{ __('Go to page :page', ['page' => $page]) }}">
79+
{{ $page }}
80+
</a>
81+
@endif
82+
@endforeach
83+
@endif
84+
@endforeach
85+
86+
{{-- Next Page Link --}}
87+
@if ($paginator->hasMorePages())
88+
<a href="{{ $paginator->nextPageUrl() }}" rel="next" class="relative inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-r-md leading-5 hover:text-gray-400 focus:z-10 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-500 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:active:bg-gray-700 dark:focus:border-blue-800" aria-label="{{ __('pagination.next') }}">
89+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
90+
<path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
91+
</svg>
92+
</a>
93+
@else
94+
<span aria-disabled="true" aria-label="{{ __('pagination.next') }}">
95+
<span class="relative inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default rounded-r-md leading-5 dark:bg-gray-800 dark:border-gray-600" aria-hidden="true">
96+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
97+
<path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
98+
</svg>
99+
</span>
100+
</span>
101+
@endif
102+
</span>
103+
</div>
104+
</div>
105+
</nav>
106+
@endif
107+

resources/views/layouts/help.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</head>
3232

3333
<body class="font-sans text-gray-900 antialiased">
34-
<div class="min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 bg-gray-100">
34+
<div class="min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 bg-gray-100 dark:bg-gray-900">
3535
<div class="mt-4 mb-4">
3636
<a href="/" class="block">
3737
@if(file_exists(public_path('logo.png')))
@@ -42,7 +42,7 @@
4242
</a>
4343
</div>
4444

45-
<div class="max-w-full sm:max-w-5xl mt-6 mx-4 mb-4 px-6 py-4 bg-white shadow-md overflow-hidden sm:rounded-lg">
45+
<div class="max-w-full sm:max-w-5xl mt-6 mx-4 mb-4 px-6 py-4 bg-white dark:bg-gray-800 shadow-md overflow-hidden sm:rounded-lg">
4646
{{ $slot }}
4747
</div>
4848
</div>

resources/views/public/index.blade.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<x-help-layout title="Help Articles">
22
<div>
3-
<h1 class="text-2xl font-bold text-gray-900 mb-6">Help Articles</h1>
3+
<h1 class="text-2xl font-bold text-gray-900 dark:text-white mb-6">Help Articles</h1>
44

55
@if($articles->count() > 0)
66
<div class="grid grid-cols-1 lg:grid-cols-4 gap-4">
77
@foreach($articles as $article)
88
<a href="{{ route('filament-help.public.show', $article->slug) }}" class="group">
9-
<div class="relative rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 transition-all duration-200 hover:shadow-md hover:ring-gray-950/10 h-full flex flex-col">
9+
<div class="fi-card relative rounded-xl bg-white dark:bg-gray-800 shadow-sm ring-1 ring-gray-950/5 dark:ring-white/10 transition-all duration-200 hover:shadow-md hover:ring-gray-950/10 dark:hover:ring-white/20 h-full flex flex-col">
1010
<div class="p-6 flex-1">
11-
<h2 class="text-lg font-semibold text-gray-900 mb-2 group-hover:text-primary-600 transition-colors">
11+
<h2 class="text-lg font-semibold text-gray-900 dark:text-white mb-2 group-hover:text-primary-600 dark:group-hover:text-primary-400 transition-colors">
1212
{{ $article->name }}
1313
</h2>
1414
@if($article->updated_at)
15-
<p class="text-sm text-gray-500">
15+
<p class="text-sm text-gray-500 dark:text-gray-400">
1616
Last updated {{ $article->updated_at->format('M j, Y') }}
1717
</p>
1818
@endif
@@ -23,30 +23,30 @@
2323
</div>
2424

2525
<div class="mt-6">
26-
{{ $articles->links() }}
26+
{{ $articles->links('filament-help::components.pagination') }}
2727
</div>
2828
@else
2929
<div class="text-center py-12">
3030
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
3131
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6-4h6m2 5.291A7.962 7.962 0 0112 15c-2.34 0-4.29-1.009-5.824-2.709M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
3232
</svg>
33-
<h3 class="mt-2 text-sm font-medium text-gray-900">No help articles available</h3>
34-
<p class="mt-1 text-sm text-gray-500">
33+
<h3 class="mt-2 text-sm font-medium text-gray-900 dark:text-white">No help articles available</h3>
34+
<p class="mt-1 text-sm text-gray-500 dark:text-gray-400">
3535
There are no public help articles at this time.
3636
</p>
3737
</div>
3838
@endif
3939

40-
<div class="mt-6 pt-4 border-t border-gray-200">
40+
<div class="mt-6 pt-4 border-t border-gray-200 dark:border-gray-700">
4141
@if(Route::has('login'))
42-
<a href="{{ route('login') }}" class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-gray-900">
42+
<a href="{{ route('login') }}" class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100">
4343
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
4444
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path>
4545
</svg>
4646
Back to Login
4747
</a>
4848
@else
49-
<a href="/" class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-gray-900">
49+
<a href="/" class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100">
5050
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
5151
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path>
5252
</svg>

resources/views/public/show.blade.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<x-help-layout :title="$article->name">
22
<div class="max-w-3xl mx-auto">
3-
<h1 class="text-2xl font-bold text-gray-900 mb-2">{{ $article->name }}</h1>
3+
<h1 class="text-2xl font-bold text-gray-900 dark:text-white mb-2">{{ $article->name }}</h1>
44
@if($article->updated_at)
5-
<p class="mb-4 text-sm text-gray-500">
5+
<p class="mb-4 text-sm text-gray-500 dark:text-gray-400">
66
Last updated {{ $article->updated_at->format('M j, Y') }}
77
</p>
88
@endif
@@ -14,35 +14,35 @@
1414
@endif
1515

1616
@if($article->content)
17-
<div class="prose max-w-none prose-headings:text-gray-900 prose-video:aspect-video mb-4">
17+
<div class="prose max-w-none dark:prose-invert prose-headings:text-gray-900 dark:prose-headings:text-white prose-video:aspect-video mb-4">
1818
{!! $article->content !!}
1919
</div>
2020
@else
2121
<div class="text-center py-8 mb-4">
2222
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
2323
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6-4h6m2 5.291A7.962 7.962 0 0112 15c-2.34 0-4.29-1.009-5.824-2.709M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
2424
</svg>
25-
<h3 class="mt-2 text-sm font-medium text-gray-900">No content available</h3>
26-
<p class="mt-1 text-sm text-gray-500">
25+
<h3 class="mt-2 text-sm font-medium text-gray-900 dark:text-white">No content available</h3>
26+
<p class="mt-1 text-sm text-gray-500 dark:text-gray-400">
2727
This help article doesn't have any content yet.
2828
</p>
2929
</div>
3030
@endif
3131

32-
<div class="flex items-center justify-between mt-4 pt-4 border-t border-gray-200">
32+
<div class="flex items-center justify-between mt-4 pt-4 border-t border-gray-200 dark:border-gray-700">
3333
<div>
3434
@if(Route::has('login'))
35-
<a href="{{ route('login') }}" class="underline text-sm text-gray-600 hover:text-gray-900 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
35+
<a href="{{ route('login') }}" class="underline text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:focus:ring-offset-gray-800">
3636
← Back to Login
3737
</a>
3838
@else
39-
<a href="/" class="underline text-sm text-gray-600 hover:text-gray-900 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
39+
<a href="/" class="underline text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:focus:ring-offset-gray-800">
4040
← Back to Login
4141
</a>
4242
@endif
4343
</div>
4444
<div>
45-
<a href="{{ route('filament-help.public.index') }}" class="underline text-sm text-gray-600 hover:text-gray-900 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
45+
<a href="{{ route('filament-help.public.index') }}" class="underline text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:focus:ring-offset-gray-800">
4646
View All Help Articles →
4747
</a>
4848
</div>

0 commit comments

Comments
 (0)