Skip to content

Commit

Permalink
refactor: remove display icon
Browse files Browse the repository at this point in the history
  • Loading branch information
NiclasNorin committed Jan 16, 2025
1 parent 816f29d commit 05b11a2
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 23 deletions.
4 changes: 0 additions & 4 deletions source/php/Component/Block/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ public function init()
$this->data['icon']['classList'][] = $this->getBaseClass('icon');
}

if (!isset($this->data['displayIcon'])) {
$this->data['displayIcon'] = true;
}

$this->data['classList'][] = $this->getBaseClass() . '--ratio-' . str_replace(":", "-", $ratio);

if(!$this->hasContent($this->data)) {
Expand Down
2 changes: 1 addition & 1 deletion source/php/Component/Block/block.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
{!! $heading !!}
@endtypography
@endif
@if ($icon && !empty($displayIcon))
@if ($icon)
@element([
'attributeList' => [
'style' => 'background-color: ' . ($iconBackgroundColor ?? 'transparent') . ';',
Expand Down
4 changes: 0 additions & 4 deletions source/php/Component/Card/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ public function init()
if (!empty($icon)) {
$this->data['icon']['classList'][] = $this->getBaseClass('icon');
}

if (!isset($this->data['displayIcon'])) {
$this->data['displayIcon'] = true;
}

if (!empty($hasPlaceholder)) {
$this->data['classList'][] = $this->getBaseClass() . '--svg-background';
Expand Down
2 changes: 1 addition & 1 deletion source/php/Component/Card/components/heading.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
@includeWhen($meta && !$metaFirst, 'Card.components.meta')
@endgroup
@includeWhen($collapsible, 'Card.components.collapsiableButton')
@includeWhen($icon && !empty($displayIcon), 'Card.components.icon')
@includeWhen($icon, 'Card.components.icon')
@endgroup
10 changes: 3 additions & 7 deletions source/php/Component/Collection__item/Collection__item.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@ public function init() {
$this->data['beforeSlotHasData'] = $this->slotHasData('before');
$this->data['floatingSlotHasData'] = $this->slotHasData('floating');

if (!empty($displayIcon)) {
$this->data['classList'][] = $this->getBaseClass('show-icon', true);
}

if (!empty($bordered)) {
$this->data['classList'][] = $this->getBaseClass('bordered', true);
}

$this->data['icon'] = $this->getIcon($icon, $displayIcon);
$this->data['icon'] = $this->getIcon($icon);

//Link handling
if($link) {
Expand All @@ -33,9 +29,9 @@ public function init() {
}
}

private function getIcon(array|string|false $icon, bool $displayIcon): array|false
private function getIcon(array|string|false $icon): array|false
{
if (!$displayIcon || !$icon) {
if (empty($icon)) {
return false;
} elseif (is_array($icon)) {
return $icon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"componentElement": "div",
"prefix": "",
"icon": false,
"displayIcon": true,
"action": false,
"secondary": "",
"link": "",
Expand Down
4 changes: 0 additions & 4 deletions source/php/Component/Segment/Segment.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ public function init()
$this->data['icon']['classList'][] = $this->getBaseClass('icon');
}

if (!isset($this->data['displayIcon'])) {
$this->data['displayIcon'] = true;
}

// If no link and exactly one button, use that button as link
if (!$link && ($buttons && count($buttons) === 1)) {
$this->data['link'] = $buttons[0]['href'];
Expand Down
2 changes: 1 addition & 1 deletion source/php/Component/Segment/components/content.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@endif
@endgroup

@if ($icon && !empty($displayIcon))
@if ($icon)
@element([
'attributeList' => [
'style' => 'background-color: ' . ($iconBackgroundColor ?? 'transparent') . ';',
Expand Down

0 comments on commit 05b11a2

Please sign in to comment.