Skip to content

Commit 36a0f95

Browse files
lchevalotlchevalot
andauthored
Add icon and icon classes support for Header (#865) (#867)
Co-authored-by: lchevalot <[email protected]>
1 parent ab15d99 commit 36a0f95

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/View/Components/Header.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ public function __construct(
1919
public ?bool $withAnchor = false,
2020
public ?string $size = 'text-2xl',
2121

22+
// Icon
23+
public ?string $icon = null,
24+
public ?string $iconClasses = null,
25+
2226
// Slots
2327
public mixed $middle = null,
2428
public mixed $actions = null,
@@ -41,12 +45,16 @@ public function render(): View|Closure|string
4145
<div id="{{ $anchor }}" {{ $attributes->class(["mb-10", "mary-header-anchor" => $withAnchor]) }}>
4246
<div class="flex flex-wrap gap-5 justify-between items-center">
4347
<div>
44-
<div @class(["$size font-extrabold", is_string($title) ? '' : $title?->attributes->get('class') ]) >
48+
<div @class(["flex", "items-center", "$size font-extrabold", is_string($title) ? '' : $title?->attributes->get('class') ]) >
4549
@if($withAnchor)
4650
<a href="#{{ $anchor }}">
4751
@endif
52+
53+
@if($icon)
54+
<x-icon name="{{ $icon }}" class="{{ $iconClasses }}" />
55+
@endif
4856
49-
{{ $title }}
57+
<span @class(["ml-2" => $icon])>{{ $title }}</span>
5058
5159
@if($withAnchor)
5260
</a>

0 commit comments

Comments
 (0)