Skip to content

Commit

Permalink
Change icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Joao Nascimento committed Jun 23, 2024
1 parent 97c9197 commit f1dbe2b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/FilamentEditEnvPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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';
}
}
8 changes: 7 additions & 1 deletion src/Livewire/ChangeEnvFileComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down

0 comments on commit f1dbe2b

Please sign in to comment.