* zin: add icon::create() method to create icon conveniently.
This commit is contained in:
@@ -33,4 +33,18 @@ class icon extends wg
|
||||
$this->children()
|
||||
);
|
||||
}
|
||||
|
||||
public static function create(string|array $nameOrProps, ?array $props = null, mixed ...$children): static
|
||||
{
|
||||
$props = $props ? $props : array();
|
||||
if(is_string($nameOrProps))
|
||||
{
|
||||
$props['name'] = $nameOrProps;
|
||||
}
|
||||
else
|
||||
{
|
||||
$props = array_merge($nameOrProps, $props);
|
||||
}
|
||||
return new static(set($props), ...$children);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user