Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE | icon-classes available for Menu and Dropdown components #716

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/View/Components/Dropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Dropdown extends Component
public function __construct(
public ?string $label = null,
public ?string $icon = 'o-chevron-down',
public ?string $iconClasses = null,
public ?bool $right = false,
public ?bool $top = false,
public ?bool $noXAnchor = false,
Expand Down Expand Up @@ -45,7 +46,7 @@ public function render(): View|Closure|string
<!-- DEFAULT TRIGGER -->
<summary x-ref="button" @click.prevent="open = !open" {{ $attributes->class(["btn normal-case"]) }}>
{{ $label }}
<x-mary-icon :name="$icon" />
<x-mary-icon :name="$icon" class="{{$iconClasses}}"/>
</summary>
@endif

Expand Down
3 changes: 2 additions & 1 deletion src/View/Components/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Menu extends Component
public function __construct(
public ?string $title = null,
public ?string $icon = null,
public ?string $iconClasses = null,
public ?bool $separator = false,
public ?bool $activateByRoute = false,
public ?string $activeBgColor = 'bg-base-300',
Expand All @@ -29,7 +30,7 @@ public function render(): View|Closure|string
<div class="flex items-center gap-2">

@if($icon)
<x-mary-icon :name="$icon" class="w-4 h-4 inline-flex" />
<x-mary-icon :name="$icon" class="w-4 h-4 inline-flex {{ $iconClasses }}"/>
@endif

{{ $title }}
Expand Down
3 changes: 2 additions & 1 deletion src/View/Components/MenuItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class MenuItem extends Component
public function __construct(
public ?string $title = null,
public ?string $icon = null,
public ?string $iconClasses = null,
public ?string $spinner = null,
public ?string $link = null,
public ?string $route = null,
Expand Down Expand Up @@ -100,7 +101,7 @@ public function render(): View|Closure|string

@if($icon)
<span class="block -mt-0.5" @if($spinner) wire:loading.class="hidden" wire:target="{{ $spinnerTarget() }}" @endif>
<x-mary-icon :name="$icon" />
<x-mary-icon :name="$icon" class="{{$iconClasses}}"/>
</span>
@endif

Expand Down
3 changes: 2 additions & 1 deletion src/View/Components/MenuSeparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class MenuSeparator extends Component
public function __construct(
public ?string $title = null,
public ?string $icon = null,
public ?string $iconClasses = null,
) {
$this->uuid = "mary" . md5(serialize($this));
}
Expand All @@ -27,7 +28,7 @@ public function render(): View|Closure|string
<div class="flex items-center gap-2">

@if($icon)
<x-mary-icon :name="$icon" />
<x-mary-icon :name="$icon" class="{{$iconClasses}}"/>
@endif

{{ $title }}
Expand Down
3 changes: 2 additions & 1 deletion src/View/Components/MenuSub.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class MenuSub extends Component
public function __construct(
public ?string $title = null,
public ?string $icon = null,
public ?string $iconClasses = null,
public bool $open = false,
public ?bool $enabled = true,
) {
Expand Down Expand Up @@ -51,7 +52,7 @@ public function render(): View|Closure|string
<details :open="show" @if($submenuActive) open @endif @click.stop>
<summary @click.prevent="toggle()" @class(["hover:text-inherit text-inherit", $activeBgColor => $submenuActive])>
@if($icon)
<x-mary-icon :name="$icon" class="inline-flex" />
<x-mary-icon :name="$icon" class="inline-flex" class="{{$iconClasses}}"/>
@endif
<span class="mary-hideable">{{ $title }}</span>
</summary>
Expand Down
3 changes: 2 additions & 1 deletion src/View/Components/MenuTitle.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class MenuTitle extends Component
public function __construct(
public ?string $title = null,
public ?string $icon = null,
public ?string $iconClasses = null,
) {
$this->uuid = 'mary'.md5(serialize($this));
}
Expand All @@ -24,7 +25,7 @@ public function render(): View|Closure|string
<div class="flex items-center gap-2">

@if($icon)
<x-mary-icon :name="$icon" />
<x-mary-icon :name="$icon" class="{{$iconClasses}}"/>
@endif

{{ $title }}
Expand Down