pagginate.blade.php
5.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
@if ($paginator->hasPages())
<span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end">
<nav aria-label="Table navigation">
<ul class="inline-flex items-center">
@if ($paginator->onFirstPage())
<li>
<button
class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple"
aria-label="Previous"
>
<svg
aria-hidden="true"
class="w-4 h-4 fill-current"
viewBox="0 0 20 20"
>
<path
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"
fill-rule="evenodd"
></path>
</svg>
</button>
</li>
@else
<li>
<a href="{{ $paginator->previousPageUrl() }}"
class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple"
aria-label="Previous"
>
<svg
aria-hidden="true"
class="w-4 h-4 fill-current"
viewBox="0 0 20 20"
>
<path
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"
fill-rule="evenodd"
></path>
</svg>
</a>
</li>
@endif
@foreach ($elements as $element)
@if (is_string($element))
<li class="disabled pagination__item"><span>{{ $element }}</span></li>
@endif
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<li>
<button class="px-3 py-1 text-white transition-colors duration-150 bg-purple-600 border border-r-0 border-purple-600 rounded-md focus:outline-none focus:shadow-outline-purple">
{{$page}}
</button>
</li>
@else
<li>
<a href="{{$url}}" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">
{{$page}}
</a>
</li>
@endif
@endforeach
@endif
@endforeach
@if ($paginator->hasMorePages())
<li>
<a href="{{ $paginator->nextPageUrl() }}"
class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple"
aria-label="Next"
>
<svg
class="w-4 h-4 fill-current"
aria-hidden="true"
viewBox="0 0 20 20"
>
<path
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"
fill-rule="evenodd"
></path>
</svg>
</a>
</li>
@else
<li>
<button
class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple"
aria-label="Next"
>
<svg
class="w-4 h-4 fill-current"
aria-hidden="true"
viewBox="0 0 20 20"
>
<path
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"
fill-rule="evenodd"
></path>
</svg>
</button>
</li>
@endif
</ul>
</nav>
</span>
@endif