Skip to content

Commit

Permalink
support icon in forms
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Feb 19, 2025
1 parent 5a01ae9 commit 33639c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion resources/views/popover-form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
$getOffset = $getOffset();
$getPopOverMaxWidth = $getPopOverMaxWidth();
$getContent = $getContent();
$getIcon = $getIcon($getState);
@endphp
<x-dynamic-component
:component="$getFieldWrapperView()"
Expand Down Expand Up @@ -34,7 +35,14 @@ class="text-sm relative w-full fi-popover-trigger cursor-pointer flex items-cent
@click="$refs.panel.toggle"
@endif
>
{{ $getState }}
{{ $getState ?? '' }}

@if($getIcon)
<x-filament::icon
:icon="$getIcon"
class="h-4 w-4 text-gray-500 dark:text-gray-400"
/>
@endif
</div>

<div class="z-50 fi-popover-content w-[{{ $getPopOverMaxWidth }}px] ring-1 ring-gray-950/5 dark:ring-white/10 rounded-lg shadow-lg bg-white dark:bg-gray-800"
Expand Down
2 changes: 2 additions & 0 deletions src/Form/PopoverForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
namespace LaraZeus\Popover\Form;

use Filament\Forms\Components\Placeholder;
use Filament\Support\Concerns\HasIcon;
use LaraZeus\Popover\Concerns\HasPopover;

class PopoverForm extends Placeholder
{
use HasPopover;
use HasIcon;

protected string $view = 'zeus-popover::popover-form';
}

0 comments on commit 33639c1

Please sign in to comment.