Skip to content

Commit

Permalink
Merge pull request #473 from helsingborg-stad/feat/allow-newsitem-ink
Browse files Browse the repository at this point in the history
feat: allow newsitem ink
  • Loading branch information
NiclasNorin authored Nov 1, 2024
2 parents 884ff5c + 8da1cb4 commit df60aa1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
7 changes: 7 additions & 0 deletions source/php/Component/NewsItem/NewsItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,12 @@ public function init() {
if ($standing) {
$this->data['classList'][] = $this->getBaseClass('standing', true);
}

if ($link) {
$this->data['componentElement'] = "a";
$this->data['attributeList']['href'] = $link;
} else {
$this->data['componentElement'] = "div";
}
}
}
4 changes: 2 additions & 2 deletions source/php/Component/NewsItem/newsItem.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="{{ $class }}" {!! $attribute !!}>
<{{ $componentElement }} class="{{ $class }}" {!! $attribute !!}>
@includeWhen($date || $subHeading || $headerLeftAreaSlotHasData || $headerRightAreaSlotHasData, 'NewsItem.components.header')
@includeWhen($heading || $titleLeftAreaSlotHasData || $titleRightAreaSlotHasData, 'NewsItem.components.title')
@includeWhen($content || $contentLeftAreaSlotHasData || $contentRightAreaSlotHasData || $image, 'NewsItem.components.main')
</div>
</{{ $componentElement }}>
6 changes: 4 additions & 2 deletions source/php/Component/NewsItem/newsItem.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"date": null,
"readTime": null,
"standing": false,
"floatingArea": null
"floatingArea": null,
"link": null
},
"description":{
"heading": "Title of the item.",
Expand All @@ -18,7 +19,7 @@
"date": "Date of the item.",
"readTime": "Read time of the item.",
"standing": "If the item will be appearing standing or laying down.",
"floatingArea": "Content that will be floating on the right side of the item."
"link": "Link to the item."
},
"types": {
"heading": "string",
Expand All @@ -28,6 +29,7 @@
"date": "string",
"readTime": "string",
"standing": "boolean",
"link": "string",
"headerRightArea": "mixed",
"headerLeftArea": "mixed",
"titleLeftArea": "mixed",
Expand Down
1 change: 1 addition & 0 deletions source/php/Component/NewsItem/partials/content.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@typography([
'classList' => [$baseClass . '__content']
])
{{ $content }}
@endtypography

0 comments on commit df60aa1

Please sign in to comment.