Skip to content

Commit 26a8315

Browse files
committed
Added sort icon configurations
Removed 1 hard coded font awesome icon
1 parent 4ab018d commit 26a8315

File tree

5 files changed

+33
-4
lines changed

5 files changed

+33
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
1010

1111
- Arabic translations
1212
- Ability to add a link to make table rows clickable
13+
- Added the ability to change the sort icons
1314

1415
### Updated
1516

1617
- Livewire to 2.x
1718

19+
### Removed
20+
21+
- Removed 1 hard coded font awesome icon
22+
1823
### Changed
1924

2025
- Publish tags to service provider

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ You can override any of these in your table component:
173173
| -------- | ------- | ----- |
174174
| $sortField | id | The initial field to be sorting by |
175175
| $sortDirection | asc | The initial direction to sort |
176+
| $sortDefaultClass | text-muted fas fa-sort | The default sort icon |
177+
| $ascSortClass | fas fa-sort-up | The sort icon when currently sorting ascending |
178+
| $descSortClass | fas fa-sort-down | The sort icon when currently sorting descending |
176179

177180
#### Pagination
178181

resources/views/includes/_columns.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ class="{{ $this->setTableHeadClass($column->attribute) }}"
1515
{{ $column->text }}
1616

1717
@if ($sortField !== $column->attribute)
18-
<i class="text-muted fas fa-sort"></i>
18+
<i class="{{ $sortDefaultClass }}"></i>
1919
@elseif ($sortDirection === 'asc')
20-
<i class="fas fa-sort-up"></i>
20+
<i class="{{ $ascSortClass }}"></i>
2121
@else
22-
<i class="fas fa-sort-down"></i>
22+
<i class="{{ $descSortClass }}"></i>
2323
@endif
2424
</span>
2525
@else

resources/views/includes/_offline.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="row">
33
<div class="col-12">
44
<div wire:offline class="alert alert-danger">
5-
<i class="fa fa-info-circle"></i> @lang('laravel-livewire-tables::strings.offline')
5+
@lang('laravel-livewire-tables::strings.offline')
66
</div>
77
</div>
88
</div>

src/Traits/Sorting.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,27 @@ trait Sorting
2525
*/
2626
public $sortDirection = 'asc';
2727

28+
/**
29+
* The default sort icon
30+
*
31+
* @var string
32+
*/
33+
public $sortDefaultClass = 'text-muted fas fa-sort';
34+
35+
/**
36+
* The sort icon when currently sorting ascending
37+
*
38+
* @var string
39+
*/
40+
public $ascSortClass = 'fas fa-sort-up';
41+
42+
/**
43+
* The sort icon when currently sorting descending
44+
*
45+
* @var string
46+
*/
47+
public $descSortClass = 'fas fa-sort-down';
48+
2849
/**
2950
* @param $attribute
3051
*/

0 commit comments

Comments
 (0)