forked from rappasoft/laravel-livewire-tables
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rappasoft#2178 from HussamAlhennawi/configuration-…
…for-filter-pills-styling Enable setting styles for filter pills as a configuration.
- Loading branch information
Showing
7 changed files
with
220 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 36 additions & 25 deletions
61
resources/views/components/tools/filter-pills/buttons/reset-all.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,36 @@ | ||
@aware(['isTailwind','isBootstrap','isBootstrap4','isBootstrap5']) | ||
@if ($isTailwind) | ||
<button | ||
wire:click.prevent="setFilterDefaults" | ||
@class([ | ||
'focus:outline-none active:outline-none' | ||
])> | ||
<span @class([ | ||
'inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium', | ||
'bg-gray-100 text-gray-800 dark:bg-gray-200 dark:text-gray-900' | ||
])> | ||
{{ __($this->getLocalisationPath.'Clear') }} | ||
</span> | ||
</button> | ||
@else | ||
<a | ||
href="#" | ||
wire:click.prevent="setFilterDefaults" | ||
@class([ | ||
'badge badge-pill badge-light' => $isBootstrap4, | ||
'badge rounded-pill bg-light text-dark text-decoration-none' => $isBootstrap5, | ||
])> | ||
{{ __($this->getLocalisationPath.'Clear') }} | ||
</a> | ||
@endif | ||
@aware(['isTailwind','isBootstrap','isBootstrap4','isBootstrap5']) | ||
@if ($isTailwind) | ||
<button | ||
wire:click.prevent="setFilterDefaults" | ||
@class([ | ||
'focus:outline-none active:outline-none' | ||
])> | ||
<span | ||
{{ | ||
$attributes->merge($this->getFilterPillsResetAllButtonAttributes()) | ||
->class([ | ||
'inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium' => $this->getFilterPillsResetAllButtonAttributes()['default-styling'], | ||
'bg-gray-100 text-gray-800 dark:bg-gray-200 dark:text-gray-900' => $this->getFilterPillsResetAllButtonAttributes()['default-colors'], | ||
]) | ||
->except(['default-styling', 'default-colors']) | ||
}} | ||
> | ||
{{ __($this->getLocalisationPath.'Clear') }} | ||
</span> | ||
</button> | ||
@else | ||
<a | ||
href="#" | ||
wire:click.prevent="setFilterDefaults" | ||
{{ | ||
$attributes->merge($this->getFilterPillsResetAllButtonAttributes()) | ||
->class([ | ||
'badge badge-pill badge-light' => $isBootstrap4 && $this->getFilterPillsResetAllButtonAttributes()['default-styling'], | ||
'badge rounded-pill bg-light text-dark text-decoration-none' => $isBootstrap5 && $this->getFilterPillsResetAllButtonAttributes()['default-styling'], | ||
]) | ||
->except(['default-styling', 'default-colors']) | ||
}} | ||
> | ||
{{ __($this->getLocalisationPath.'Clear') }} | ||
</a> | ||
@endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/Traits/Styling/Configuration/FilterPillsStylingConfiguration.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace Rappasoft\LaravelLivewireTables\Traits\Styling\Configuration; | ||
|
||
trait FilterPillsStylingConfiguration | ||
{ | ||
public function setFilterPillsItemAttributes(array $attributes = []): self | ||
{ | ||
$this->filterPillsItemAttributes = [...$this->filterPillsItemAttributes, ...$attributes]; | ||
|
||
return $this; | ||
} | ||
|
||
public function setFilterPillsResetFilterButtonAttributes(array $attributes = []): self | ||
{ | ||
$this->filterPillsResetFilterButtonAttributes = [...$this->filterPillsResetFilterButtonAttributes, ...$attributes]; | ||
|
||
return $this; | ||
} | ||
|
||
public function setFilterPillsResetAllButtonAttributes(array $attributes = []): self | ||
{ | ||
$this->filterPillsResetAllButtonAttributes = [...$this->filterPillsResetAllButtonAttributes, ...$attributes]; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Rappasoft\LaravelLivewireTables\Traits\Styling\Helpers; | ||
|
||
use Livewire\Attributes\Computed; | ||
|
||
trait FilterPillsStylingHelpers | ||
{ | ||
#[Computed] | ||
public function getFilterPillsItemAttributes(): array | ||
{ | ||
return $this->filterPillsItemAttributes; | ||
} | ||
|
||
#[Computed] | ||
public function getFilterPillsResetFilterButtonAttributes(): array | ||
{ | ||
return $this->filterPillsResetFilterButtonAttributes; | ||
} | ||
|
||
#[Computed] | ||
public function getFilterPillsResetAllButtonAttributes(): array | ||
{ | ||
return $this->filterPillsResetAllButtonAttributes; | ||
} | ||
} |