Created
March 21, 2020 13:24
-
-
Save khatabwedaa/be9aae1417dfa01fd9860a5dce23e0bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@if ($paginator->hasPages()) | |
<nav> | |
<ul class="flex"> | |
{{-- Previous Page Link --}} | |
@if ($paginator->onFirstPage()) | |
<li class="flex items-center mr-1 px-3 py-2 bg-gray-200 text-gray-500 rounded-lg" aria-disabled="true" aria-label="@lang('pagination.previous')"> | |
<span class="font-bold text-sm" aria-hidden="true">Previous</span> | |
</li> | |
@else | |
<li class="flex items-center mr-1 px-3 py-2 bg-gray-200 text-gray-700 hover:bg-gray-700 hover:text-gray-200 rounded-lg"> | |
<a class="font-bold text-sm" href="{{ $paginator->previousPageUrl() }}" rel="prev" aria-label="@lang('pagination.previous')">Previous</a> | |
</li> | |
@endif | |
{{-- Pagination Elements --}} | |
@foreach ($elements as $element) | |
{{-- "Three Dots" Separator --}} | |
@if (is_string($element)) | |
<li class="flex items-center mr-1 px-3 py-2 bg-gray-200 text-gray-500 rounded-lg" aria-disabled="true"><span class="font-bold text-sm">{{ $element }}</span></li> | |
@endif | |
{{-- Array Of Links --}} | |
@if (is_array($element)) | |
@foreach ($element as $page => $url) | |
@if ($page == $paginator->currentPage()) | |
<li class="flex items-center mx-1 px-3 py-2 bg-gray-700 text-gray-200 rounded-lg" aria-current="page"><span class="font-bold text-sm">{{ $page }}</span></li> | |
@else | |
<li class="flex items-center mx-1 px-3 py-2 bg-gray-200 text-gray-700 hover:bg-gray-700 hover:text-gray-200 rounded-lg"><a class="font-bold text-sm" href="{{ $url }}">{{ $page }}</a></li> | |
@endif | |
@endforeach | |
@endif | |
@endforeach | |
{{-- Next Page Link --}} | |
@if ($paginator->hasMorePages()) | |
<li class="flex items-center mx-1 px-3 py-2 bg-gray-200 text-gray-700 hover:bg-gray-700 hover:text-gray-200 rounded-lg"> | |
<a class="font-bold text-sm" href="{{ $paginator->nextPageUrl() }}" rel="next" aria-label="@lang('pagination.next')">Next</a> | |
</li> | |
@else | |
<li class="flex items-center mx-1 px-3 py-2 bg-gray-200 text-gray-500 rounded-lg" aria-disabled="true" aria-label="@lang('pagination.next')"> | |
<span class="font-bold text-sm" aria-hidden="true">Next</span> | |
</li> | |
@endif | |
</ul> | |
</nav> | |
@endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment