35 lines
798 B
PHP
35 lines
798 B
PHP
@props([
|
|
'active' => false, // boolean whether the tab is active
|
|
'label' => null, // tab label
|
|
'icon' => null, // icon name only
|
|
'color' => '', // optional icon color
|
|
])
|
|
|
|
@php
|
|
$isActive = (bool) $active;
|
|
|
|
$classes = trim(collect([
|
|
'pagelink',
|
|
$isActive ? 'is-active' : null,
|
|
])->filter()->implode(' '));
|
|
|
|
$iconComponent = null;
|
|
if ($icon) {
|
|
$iconComponent = $isActive
|
|
? 'icon-solid.'.$icon
|
|
: 'icon-'.$icon;
|
|
}
|
|
@endphp
|
|
|
|
<a {{ $attributes->merge(['class' => $classes]) }}>
|
|
@if ($iconComponent)
|
|
<x-dynamic-component :component="$iconComponent" width="20" :color="$color" />
|
|
@endif
|
|
|
|
@if (!is_null($label))
|
|
<span>{{ $label }}</span>
|
|
@else
|
|
{{ $slot }}
|
|
@endif
|
|
</a>
|