Skip to content

Commit

Permalink
Add icon
Browse files Browse the repository at this point in the history
  • Loading branch information
francoism90 committed Jul 8, 2024
1 parent 3aa8533 commit c274dcc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
15 changes: 15 additions & 0 deletions src/Support/Html/Elements/Icon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Foxws\WireUse\Support\Html\Elements;

use Spatie\Html\BaseElement;

class Icon extends BaseElement
{
protected $tag = 'span';

public function svg(?string $name = null, ?string $class = null)
{
return $this->html(svg($name, $class));

Check failure on line 13 in src/Support/Html/Elements/Icon.php

View workflow job for this annotation

GitHub Actions / phpstan

Function svg not found.
}
}
13 changes: 7 additions & 6 deletions src/Support/Html/Mixins/HtmlExtendedMixin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Foxws\WireUse\Support\Html\Mixins;

use Foxws\WireUse\Support\Html\Elements\Icon;
use Livewire\Form;
use Spatie\Html\Elements\Div;

Expand All @@ -11,19 +12,19 @@ class HtmlExtendedMixin

public function wireForm(): mixed
{
return function (?Form $value = null): static {
return function (?Form $value = null): static
{
$this->form = $value;

return $this;
};
}

public function icon(): mixed
public function icon()
{
return function (string $name, ?string $class = null, ?array $attributes = []): Div {
/** @var Div $this */

return $this->div(svg($name, $class, $attributes));
return function (): Icon
{
return Icon::create();
};
}
}

0 comments on commit c274dcc

Please sign in to comment.