Skip to content

Commit

Permalink
Merge pull request #329 from helsingborg-stad/feature/add-placeholder…
Browse files Browse the repository at this point in the history
…-image-segment

Feat: Placeholder image added the correct way
  • Loading branch information
NiclasNorin authored Sep 8, 2023
2 parents 78c578f + 88f1bd6 commit 8037678
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion source/php/Component/Card/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function init()
$this->data['displayIcon'] = true;
}

if ($hasPlaceholder) {
if (!empty($hasPlaceholder)) {
$this->data['classList'][] = $this->getBaseClass() . '--svg-background';
}

Expand Down
4 changes: 4 additions & 0 deletions source/php/Component/Segment/Segment.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public function init()
$this->data['link'] = $buttons[0]['href'];
}

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

$this->data['imageClassList'] = [];

if ($this->data['content'] == strip_tags($this->data['content'], [])) {
Expand Down
8 changes: 5 additions & 3 deletions source/php/Component/Segment/segment.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"textSize": "default",
"image": false,
"imageFocus": {
"top": 30,
"top": 50,
"left": 50
},
"background": false,
Expand All @@ -25,7 +25,8 @@
"meta": false,
"tags": false,
"icon": false,
"link": false
"link": false,
"hasPlaceholderImage": false
},
"description": {
"layout": "Which layout to use",
Expand All @@ -49,7 +50,8 @@
"date": "The date",
"tags": "Array of tags according to the tags component",
"meta": "The meta text",
"icon": "An array with the same specification as the icon component"
"icon": "An array with the same specification as the icon component",
"hasPlaceholderImage": "Sets image specific styling based on the image being a placholder image."
},
"view": "segment.blade.php",
"dependency": {
Expand Down

0 comments on commit 8037678

Please sign in to comment.