diff options
Diffstat (limited to 'src/Toolbar/Dropdown')
| -rw-r--r-- | src/Toolbar/Dropdown/Button.php | 30 | ||||
| -rw-r--r-- | src/Toolbar/Dropdown/Item.php | 16 | ||||
| -rw-r--r-- | src/Toolbar/Dropdown/Link.php | 30 |
3 files changed, 76 insertions, 0 deletions
diff --git a/src/Toolbar/Dropdown/Button.php b/src/Toolbar/Dropdown/Button.php new file mode 100644 index 0000000..83aefbf --- /dev/null +++ b/src/Toolbar/Dropdown/Button.php @@ -0,0 +1,30 @@ +<?php + +declare(strict_types=1); + +namespace Lightscale\LaralightTables\Toolbar\Dropdown; + +use Illuminate\View\View; +use Lightscale\LaralightTables\Toolbar\Concerns\WithAction; +use Lightscale\LaralightTables\Toolbar\Concerns\WithAttributes; +use Lightscale\LaralightTables\Toolbar\Concerns\WithSlot; + +class Button extends Item +{ + use WithAction; + use WithAttributes; + use WithSlot; + + public function render(): View + { + return view( + 'laralight-tables::dropdown.button', + [ + 'attributes' => $this->getAttributes([ + 'wire:click' => $this->action, + ]), + 'slot' => $this->slot, + ] + ); + } +} diff --git a/src/Toolbar/Dropdown/Item.php b/src/Toolbar/Dropdown/Item.php new file mode 100644 index 0000000..c10c8f3 --- /dev/null +++ b/src/Toolbar/Dropdown/Item.php @@ -0,0 +1,16 @@ +<?php + +declare(strict_types=1); + +namespace Lightscale\LaralightTables\Toolbar\Dropdown; + +use Illuminate\Support\HtmlString; +use Illuminate\View\View; +use Lightscale\LaralightTables\Concerns\Makable; + +abstract class Item +{ + use Makable; + + abstract public function render(): View|HtmlString|string|null; +} diff --git a/src/Toolbar/Dropdown/Link.php b/src/Toolbar/Dropdown/Link.php new file mode 100644 index 0000000..2602f41 --- /dev/null +++ b/src/Toolbar/Dropdown/Link.php @@ -0,0 +1,30 @@ +<?php + +declare(strict_types=1); + +namespace Lightscale\LaralightTables\Toolbar\Dropdown; + +use Illuminate\View\View; +use Lightscale\LaralightTables\Toolbar\Concerns\WithAttributes; +use Lightscale\LaralightTables\Toolbar\Concerns\WithHref; +use Lightscale\LaralightTables\Toolbar\Concerns\WithSlot; + +class Link extends Item +{ + use WithAttributes; + use WithHref; + use WithSlot; + + public function render(): View + { + return view( + 'laralight-tables::dropdown.link', + [ + 'attributes' => $this->getAttributes([ + 'href' => $this->href, + ]), + 'slot' => $this->slot, + ] + ); + } +} |
