Skip to content

Commit edc63d9

Browse files
Ability do pass multiply variant attribute value
1 parent 65d1e80 commit edc63d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Components/Wrapper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Wrapper extends ViewComponent
1414
public function __construct(
1515
string $component,
1616
string $tag = 'div',
17-
string $variant = 'normal',
17+
string|array $variant = 'normal',
1818
bool $tagSelfClose = false
1919
) {
2020
$this->blessUi = compact('component', 'tag', 'variant', 'tagSelfClose');
@@ -33,7 +33,7 @@ public function render()
3333
$componentClass = Config::get('bless-ui.prefix') . $this->blessUi['component'];
3434

3535
$baseClasses = $config['base'] ?? null;
36-
$variantClasses = $config['variants'][$this->blessUi['variant']] ?? null;
36+
$variantClasses = collect((array) $this->blessUi['variant'])->map(fn ($key) => $config['variants'][$key] ?? null)->flatten()->toArray();
3737

3838
$attributes = $data['attributes']
3939
->class($baseClasses)

0 commit comments

Comments
 (0)