Skip to content
This repository was archived by the owner on Dec 11, 2021. It is now read-only.

Commit 9c525d5

Browse files
committed
Build Pagination
1 parent 5cb7005 commit 9c525d5

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed
Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,46 @@
1-
{{-- WIP --}}
1+
@if ($paginator->hasPages())
2+
<nav dir="ltr">
3+
<div class="flex font-roboto rounded">
4+
{{-- Previous Page Link --}}
5+
@if ($paginator->onFirstPage())
6+
<a class="py-2 px-4 leading-tight bg-white border border-gray-200 text-blue-700 border-r-0 ml-0 rounded-l" aria-disabled="true" aria-label="@lang('pagination.previous')">
7+
<span aria-hidden="true">Previous</span>
8+
</a>
9+
@else
10+
<a href="{{ $paginator->previousPageUrl() }}" class="fpy-2 px-4 leading-tight bg-white border border-gray-200 text-blue-700 border-r-0 hover:bg-blue-500 hover:text-white">
11+
<span rel="prev" aria-label="@lang('pagination.previous')">Previous</span>
12+
</a>
13+
@endif
14+
15+
{{-- Pagination Elements --}}
16+
@foreach ($elements as $element)
17+
{{-- "Three Dots" Separator --}}
18+
@if (is_string($element))
19+
<a class="py-2 px-4 leading-tight bg-white border border-gray-200 text-blue-700 border-r-0 hover:bg-blue-500 hover:text-white" aria-disabled="true"><span class="">{{ $element }}</span></a>
20+
@endif
21+
22+
{{-- Array Of Links --}}
23+
@if (is_array($element))
24+
@foreach ($element as $page => $url)
25+
@if ($page == $paginator->currentPage())
26+
<a class="py-2 px-4 leading-tight bg-white border border-gray-200 text-blue-700 border-r-0" aria-current="page"><span>{{ $page }}</span></a>
27+
@else
28+
<a href="{{ $url }}" class="py-2 px-4 leading-tight bg-white border border-gray-200 text-blue-700 border-r-0 hover:bg-blue-500 hover:text-white"><span>{{ $page }}</span></a>
29+
@endif
30+
@endforeach
31+
@endif
32+
@endforeach
33+
34+
{{-- Next Page Link --}}
35+
@if ($paginator->hasMorePages())
36+
<a href="{{ $paginator->nextPageUrl() }}" class="py-2 px-4 leading-tight bg-white border border-gray-200 text-blue-700 border-r hover:bg-blue-500 hover:text-white rounded-r">
37+
<span rel="next" aria-label="@lang('pagination.next')">Next</span>
38+
</a>
39+
@else
40+
<a class="py-2 px-4 leading-tight bg-white border border-gray-200 text-blue-700 border-r" aria-disabled="true" aria-label="@lang('pagination.next')">
41+
<span aria-hidden="true">Next</span>
42+
</a>
43+
@endif
44+
</div>
45+
</nav>
46+
@endif

0 commit comments

Comments
 (0)