diff options
4 files changed, 26 insertions, 0 deletions
diff --git a/workbench/app/Livewire/ProductsTable.php b/workbench/app/Livewire/ProductsTable.php index 6a52cc5..c3e29a5 100644 --- a/workbench/app/Livewire/ProductsTable.php +++ b/workbench/app/Livewire/ProductsTable.php @@ -19,6 +19,8 @@ class ProductsTable extends Table { protected $model = Product::class; + protected string $tableClass = 'table mb-0'; + public function toolbars(): array { $categoryFilter = SelectFilter::make('category') @@ -67,4 +69,13 @@ class ProductsTable extends Table ->sortable(fn (Builder $q, string $dir) => $q->orderBy('stock', $dir)), ]; } + + public function wrapperComponent(string $location): array + { + return match ($location) { + 'table' => ['table.card-table', ['title' => 'Products']], + 'pagination' => ['table.card-pagination'], + default => parent::wrapperComponent($location), + }; + } } diff --git a/workbench/resources/views/components/layouts/app.blade.php b/workbench/resources/views/components/layouts/app.blade.php index e453da8..ab0fc86 100644 --- a/workbench/resources/views/components/layouts/app.blade.php +++ b/workbench/resources/views/components/layouts/app.blade.php @@ -4,6 +4,11 @@ <title>Livewire tables</title> <link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}" /> <x-laralight-assets::head /> + <style> + .card .table tr:last-child > td { + border-bottom-width: 0; + } + </style> </head> <body> diff --git a/workbench/resources/views/components/table/card-pagination.blade.php b/workbench/resources/views/components/table/card-pagination.blade.php new file mode 100644 index 0000000..fad0907 --- /dev/null +++ b/workbench/resources/views/components/table/card-pagination.blade.php @@ -0,0 +1,4 @@ + <div class="card-footer"> + {{ $slot }} + </div> +</div> diff --git a/workbench/resources/views/components/table/card-table.blade.php b/workbench/resources/views/components/table/card-table.blade.php new file mode 100644 index 0000000..a08f400 --- /dev/null +++ b/workbench/resources/views/components/table/card-table.blade.php @@ -0,0 +1,6 @@ +@props(['title']) +<div class="card"> + <h2 class="card-header"> + {{ $title }} + </h2> + {{ $slot }} |