Skip to content

Commit

Permalink
Icon: Use fully qualified names as-is
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Oct 9, 2024
1 parent 09afc04 commit e0918eb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Widget/Icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use ipl\Html\Attributes;
use ipl\Html\BaseHtmlElement;
use ipl\Stdlib\Str;

/**
* Icon element
Expand All @@ -30,9 +31,13 @@ class Icon extends BaseHtmlElement
*/
public function __construct(string $name, $attributes = null)
{
if (! Str::startsWith($name, 'fa-')) {
$name = "fa-$name";
}

$this
->getAttributes()
->add('class', ['icon', "fa-$name"])
->add('class', ['icon', $name])
->add($attributes);
}

Expand Down

0 comments on commit e0918eb

Please sign in to comment.