diff --git a/src/FilamentEditEnvPlugin.php b/src/FilamentEditEnvPlugin.php index ce30eaf..39e0424 100644 --- a/src/FilamentEditEnvPlugin.php +++ b/src/FilamentEditEnvPlugin.php @@ -18,6 +18,8 @@ class FilamentEditEnvPlugin implements Plugin public bool | Closure | null $showButton = null; + public string | Closure | null $setIcon = null; + public function getId(): string { return 'filament-edit-env'; @@ -70,4 +72,16 @@ public function showButton(bool | Closure $showButton = true): static return $this; } + + public function setIcon(string | Closure $setIcon = 'heroicon-o-command-line'): static + { + $this->setIcon = $setIcon; + + return $this; + } + + public function getIcon(): string + { + return $this->evaluate($this->setIcon) ?? 'heroicon-o-command-line'; + } } diff --git a/src/Livewire/ChangeEnvFileComponent.php b/src/Livewire/ChangeEnvFileComponent.php index 1288aee..0d4b4d8 100644 --- a/src/Livewire/ChangeEnvFileComponent.php +++ b/src/Livewire/ChangeEnvFileComponent.php @@ -16,10 +16,16 @@ class ChangeEnvFileComponent extends Component implements HasActions, HasForms use InteractsWithActions; use InteractsWithForms; + public string $icon = ''; + + public function mount() + { + $this->icon = \Joaopaulolndev\FilamentEditEnv\FilamentEditEnvPlugin::get()->getIcon(); + } public function editAction() { return Action::make('edit') - ->icon('heroicon-o-command-line') + ->icon($this->icon) ->iconButton() ->modalHeading(__('filament-edit-env::default.heading')) ->form([