@if ($paginator->hasPages())
<nav class="flex items-center gap-2 pagination">

    {{-- Prev --}}
    @if ($paginator->onFirstPage())
        <span class="px-4 py-2 rounded-full bg-gray-100 text-gray-400">Prev</span>
    @else
        <a href="{{ $paginator->previousPageUrl() }}"
           data-page="{{ $paginator->currentPage() - 1 }}"
           class="pagination-link px-4 py-2 rounded-full border hover:bg-yellow-400">
           Prev
        </a>
    @endif

    {{-- Pages --}}
    @foreach ($elements as $element)
        @if (is_array($element))
            @foreach ($element as $page => $url)
                @if ($page == $paginator->currentPage())
                    <span class="px-4 py-2 rounded-full bg-yellow-400 font-semibold">
                        {{ $page }}
                    </span>
                @else
                    <a href="{{ $url }}"
                       data-page="{{ $page }}"
                       class="pagination-link px-4 py-2 rounded-full border hover:bg-yellow-400">
                        {{ $page }}
                    </a>
                @endif
            @endforeach
        @endif
    @endforeach

    {{-- Next --}}
    @if ($paginator->hasMorePages())
        <a href="{{ $paginator->nextPageUrl() }}"
           data-page="{{ $paginator->currentPage() + 1 }}"
           class="pagination-link px-4 py-2 rounded-full border hover:bg-yellow-400">
           Next
        </a>
    @else
        <span class="px-4 py-2 rounded-full bg-gray-100 text-gray-400">Next</span>
    @endif

</nav>
@endif
