parent
62173e9ace
commit
d4486c4b2f
5 changed files with 100 additions and 49 deletions
@ -0,0 +1,22 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace App\View\Components; |
||||||
|
|
||||||
|
use Illuminate\View\Component; |
||||||
|
|
||||||
|
class SkeletonForm extends Component |
||||||
|
{ |
||||||
|
public $fields; |
||||||
|
public $buttonCount; |
||||||
|
|
||||||
|
public function __construct(int $fields = 2, int $buttonCount = 2) |
||||||
|
{ |
||||||
|
$this->fields = $fields; |
||||||
|
$this->buttonCount = $buttonCount; |
||||||
|
} |
||||||
|
|
||||||
|
public function render() |
||||||
|
{ |
||||||
|
return view('components.skeleton-form'); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,24 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace App\View\Components; |
||||||
|
|
||||||
|
use Illuminate\View\Component; |
||||||
|
|
||||||
|
class SkeletonTable extends Component |
||||||
|
{ |
||||||
|
public $columns; |
||||||
|
public $rows; |
||||||
|
public $height; |
||||||
|
|
||||||
|
public function __construct(int $columns = 3, int $rows = 5, string $height = '3.5rem') |
||||||
|
{ |
||||||
|
$this->columns = $columns; |
||||||
|
$this->rows = $rows; |
||||||
|
$this->height = $height; |
||||||
|
} |
||||||
|
|
||||||
|
public function render() |
||||||
|
{ |
||||||
|
return view('components.skeleton-table'); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
@props(['fields', 'buttonCount']) |
||||||
|
|
||||||
|
<div wire:loading class="w-100"> |
||||||
|
<div class="p-4 border rounded-lg shadow-sm max-w-md mx-auto space-y-4"> |
||||||
|
{{-- Title --}} |
||||||
|
<div class="skeleton rounded" style="width:10rem; height:2rem;"></div> |
||||||
|
|
||||||
|
{{-- Fields --}} |
||||||
|
<div class="space-y-3 mt-2"> |
||||||
|
@for ($i = 0; $i < $fields; $i++) |
||||||
|
<div class="skeleton rounded" style="width:100%; height:3.5rem;"></div> |
||||||
|
@endfor |
||||||
|
</div> |
||||||
|
|
||||||
|
{{-- Buttons --}} |
||||||
|
<div class="d-flex justify-content-end gap-3 mt-2"> |
||||||
|
@for ($i = 0; $i < $buttonCount; $i++) |
||||||
|
<div class="skeleton rounded" style="width:5.5rem; height:2.5rem;"></div> |
||||||
|
@endfor |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
@ -0,0 +1,26 @@ |
|||||||
|
@props(['columns', 'rows', 'height']) |
||||||
|
|
||||||
|
<div wire:loading class="w-100"> |
||||||
|
<div class="table-responsive w-100"> |
||||||
|
<table class="table mb-0 w-100"> |
||||||
|
<thead> |
||||||
|
<tr style="visibility:hidden; height:{{ $height }}"> |
||||||
|
@for ($i = 0; $i < $columns; $i++) |
||||||
|
<th> </th> |
||||||
|
@endfor |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
@for ($r = 0; $r < $rows; $r++) |
||||||
|
<tr style="height:{{ $height }}"> |
||||||
|
@for ($c = 0; $c < $columns; $c++) |
||||||
|
<td class="align-middle"> |
||||||
|
<div class="skeleton rounded w-100" style="height:1.75rem"></div> |
||||||
|
</td> |
||||||
|
@endfor |
||||||
|
</tr> |
||||||
|
@endfor |
||||||
|
</tbody> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
</div> |
Loading…
Reference in new issue