@if ($paginator->hasPages())
    <nav class="pg" role="navigation" aria-label="페이지 네비게이션">
        {{-- Prev --}}
        @if ($paginator->onFirstPage())
            <span class="pg-btn is-disabled" aria-disabled="true">이전</span>
        @else
            <a class="pg-btn" href="{{ $paginator->previousPageUrl() }}" rel="prev">이전</a>
        @endif

        {{-- Pages --}}
        <div class="pg-pages">
            @foreach ($elements as $element)
                @if (is_string($element))
                    <span class="pg-ellipsis">{{ $element }}</span>
                @endif

                @if (is_array($element))
                    @foreach ($element as $page => $url)
                        @if ($page == $paginator->currentPage())
                            <span class="pg-page is-active" aria-current="page">{{ $page }}</span>
                        @else
                            <a class="pg-page" href="{{ $url }}">{{ $page }}</a>
                        @endif
                    @endforeach
                @endif
            @endforeach
        </div>

        {{-- Next --}}
        @if ($paginator->hasMorePages())
            <a class="pg-btn" href="{{ $paginator->nextPageUrl() }}" rel="next">다음</a>
        @else
            <span class="pg-btn is-disabled" aria-disabled="true">다음</span>
        @endif
    </nav>
@endif
