Skip to content

Commit

Permalink
Allow label to be null
Browse files Browse the repository at this point in the history
  • Loading branch information
juniwalk authored Mar 27, 2024
1 parent d380d45 commit b9fefa1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/UI/Actions/Controls/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Button extends UIControl implements Action, Component

public function __construct(
private string $name,
private string $label,
private ?string $label = null,
string $dest,
array $args = [],
) {
Expand Down
2 changes: 1 addition & 1 deletion src/UI/Actions/Controls/Dropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Dropdown extends UIControl implements Action

public function __construct(
private string $name,
string $label,
?string $label = null,
) {
$this->control = $this->addAction(new Button('_btn', $label, '#'));
$this->name = Strings::webalize($name);
Expand Down
4 changes: 2 additions & 2 deletions src/UI/Actions/Traits/Actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public function addGroup(?string $name = null): Action
}


public function addButton(string $name, string $label, string $link = null, array $args = []): Action
public function addButton(string $name, string $label = null, string $link = null, array $args = []): Action
{
$action = new Button($name, $label, $link ?? $name, $args);
return $this->addAction($action);
}


public function addDropdown(string $name, string $label): Action
public function addDropdown(string $name, string $label = null): Action
{
$action = new Dropdown($name, $label);
return $this->addAction($action);
Expand Down

0 comments on commit b9fefa1

Please sign in to comment.