first
This commit is contained in:
16
resources/views/components/sort-th.blade.php
Normal file
16
resources/views/components/sort-th.blade.php
Normal file
@@ -0,0 +1,16 @@
|
||||
@props(['column', 'label'])
|
||||
@php
|
||||
$currentSort = request('sort');
|
||||
$currentDir = request('direction', 'asc');
|
||||
$active = $currentSort === $column;
|
||||
$nextDir = ($active && $currentDir === 'asc') ? 'desc' : 'asc';
|
||||
$icon = $active
|
||||
? ($currentDir === 'asc' ? 'bi-sort-down' : 'bi-sort-up')
|
||||
: 'bi-arrow-down-up';
|
||||
@endphp
|
||||
<th {{ $attributes }}>
|
||||
<a href="{{ request()->fullUrlWithQuery(['sort' => $column, 'direction' => $nextDir, 'page' => null]) }}"
|
||||
class="text-decoration-none d-inline-flex align-items-center gap-1 {{ $active ? 'fw-semibold text-primary' : 'link-secondary' }}">
|
||||
{{ $label }}<i class="bi {{ $icon }} small"></i>
|
||||
</a>
|
||||
</th>
|
||||
Reference in New Issue
Block a user