the browser-facing portion of osu!
at master 41 lines 1.7 kB view raw
1{{-- 2 Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 3 See the LICENCE file in the repository root for full licence text. 4--}} 5@php 6 $query = array_merge(request()->query()); 7 unset($query['page']); 8 $searchParams = $search->getParams(); 9@endphp 10<div class="sort sort--default-padding"> 11 <div class="sort__items"> 12 <span class="sort__item sort__item--title"> 13 {{ osu_trans('sort._') }} 14 </span> 15 @foreach (App\Libraries\Search\UserSearchParams::VALID_SORT_FIELDS as $field) 16 @php 17 $active = $field === $searchParams->sortField; 18 if ($active) { 19 $currentOrder = $searchParams->sortOrder; 20 $order = $currentOrder === 'asc' ? 'desc' : 'asc'; 21 $arrowOrder = $currentOrder; 22 } else { 23 $order = App\Libraries\Search\UserSearchParams::defaultSortOrder($field); 24 $arrowOrder = $order; 25 } 26 $sort = "{$field}_{$order}"; 27 $arrowClass = $arrowOrder === 'asc' ? 'fas fa-caret-up' : 'fas fa-caret-down'; 28 @endphp 29 <a 30 class="{{ class_with_modifiers('sort__item', ['active' => $active, 'button' => true]) }}" 31 href="{{ route('search', array_merge($query, compact('sort'))) }}" 32 > 33 {{ osu_trans("sort.users.{$field}") }} 34 35 <span class="sort__item-arrow"> 36 <i class="{{ $arrowClass }}"></i> 37 </span> 38 </a> 39 @endforeach 40 </div> 41</div>