refactor(ui): extract admin mini bar row blade component
This commit is contained in:
46
resources/views/admin/components/mini_bar_row.blade.php
Normal file
46
resources/views/admin/components/mini_bar_row.blade.php
Normal file
@@ -0,0 +1,46 @@
|
||||
@php
|
||||
/**
|
||||
* Admin UI Component: Mini Bar Row (link)
|
||||
*
|
||||
* Required:
|
||||
* - $href
|
||||
* - $label
|
||||
* - $pct
|
||||
* - $value
|
||||
*
|
||||
* Optional:
|
||||
* - $rowRole
|
||||
* - $barRole
|
||||
* - $title
|
||||
* - $ariaLabel
|
||||
* - $class
|
||||
*/
|
||||
|
||||
$href = (string) ($href ?? '#');
|
||||
$label = (string) ($label ?? '');
|
||||
$pct = (float) ($pct ?? 0);
|
||||
$value = (string) ($value ?? '');
|
||||
|
||||
$rowRole = (string) ($rowRole ?? '');
|
||||
$barRole = (string) ($barRole ?? '');
|
||||
$title = (string) ($title ?? '');
|
||||
$ariaLabel = (string) ($ariaLabel ?? '');
|
||||
$class = (string) ($class ?? '');
|
||||
|
||||
$pct = max(0, min(100, $pct));
|
||||
@endphp
|
||||
|
||||
<a class="adm-mini-bar-row adm-mini-bar-row-link {{ $class }}"
|
||||
@if($rowRole !== '') data-role="{{ $rowRole }}" @endif
|
||||
href="{!! $href !!}"
|
||||
@if($ariaLabel !== '') aria-label="{{ $ariaLabel }}" @endif
|
||||
>
|
||||
<div class="adm-mini-bar-label">{{ $label }}</div>
|
||||
<div class="adm-mini-bar"
|
||||
@if($barRole !== '') data-role="{{ $barRole }}" @endif
|
||||
@if($title !== '') title="{{ $title }}" @endif
|
||||
>
|
||||
<span class="adm-mini-bar-fill" style="width: {{ $pct }}%"></span>
|
||||
</div>
|
||||
<div class="adm-mini-bar-value">{{ $value }}</div>
|
||||
</a>
|
||||
Reference in New Issue
Block a user