Skip to content

Commit 0475875

Browse files
authored
Allow the usage of HTML tags in accordion-item description (#722)
1 parent ad1d0ce commit 0475875

File tree

5 files changed

+52
-3
lines changed

5 files changed

+52
-3
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# 2.67.1 (2024-08-26)
2+
3+
### Improvements
4+
5+
- **Accordion**:
6+
- Allow the usage of HTML tags in `accordion-item` description
7+
- Add documentation on how to update the accordion item height
8+
19
# 2.67.0 (2024-08-08)
210

311
### Improvements

projects/demo/src/app/demo/pages/accordion-page/accordion-item-page.component.html

+14
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,20 @@ <h3>Directive</h3>
6363
</pa-demo-usage>
6464

6565
<pa-demo-code>
66+
<h4>Static accordion item:</h4>
6667
<pre><code>{{code}}</code></pre>
68+
69+
<h4>updateContentHeight method</h4>
70+
<!-- prettier-ignore -->
71+
<p>
72+
When the content of an accordion item is dynamically loaded, or when it contains some blocks conditionally
73+
visible, you may need the component to update its height. <code>accordion-item</code> component includes a public method <code>updateContentHeight</code> to do so.
74+
</p>
75+
<p>For example, given the following template:</p>
76+
<pre><code>{{conditionalExampleTemplate}}</code></pre>
77+
78+
<!-- prettier-ignore -->
79+
<p>We then reference the accordion item in the component, so we can call <code>updateContentHeight</code> whenever we need.</p>
80+
<pre><code>{{updateHeightExample}}</code></pre>
6781
</pa-demo-code>
6882
</pa-demo-page>

projects/demo/src/app/demo/pages/accordion-page/accordion-item-page.component.ts

+26-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,32 @@ export class AccordionItemPageComponent {
1818
description="Some description also visible in the header"
1919
[(expanded)]="expanded">
2020
<pa-accordion-item-body>
21-
Some content
21+
Some static content
2222
</pa-accordion-item-body>
2323
</pa-accordion-item>`;
24+
25+
conditionalExampleTemplate = `<pa-accordion-item
26+
#myAccordionItem
27+
id="item1"
28+
itemTitle="Standalone accordion item"
29+
description="Some description also visible in the header"
30+
[(expanded)]="expanded">
31+
<pa-accordion-item-body>
32+
<p>Some static content.</p>
33+
@if (dynamicContent) {
34+
<p>Some dynamic content.</p>
35+
}
36+
</pa-accordion-item-body>
37+
</pa-accordion-item>`;
38+
39+
updateHeightExample = `export class MyComponent {
40+
@ViewChild('myAccordionItem', { read: AccordionItemComponent }) myAccordionItem?: AccordionItemComponent;
41+
expanded = false;
42+
dynamicContent = false;
43+
44+
toggleDynamicContent() {
45+
this.dynamicContent = !this.dynamicContent;
46+
this.myAccordionItem?.updateContentHeight();
47+
}
48+
}`;
2449
}

projects/pastanaga-angular/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@guillotinaweb/pastanaga-angular",
33
"description": "Provides Pastanaga UI elements as Angular components",
4-
"version": "2.67.0",
4+
"version": "2.67.1",
55
"license": "MIT",
66
"keywords": [
77
"angular",

projects/pastanaga-angular/src/lib/accordion/accordion-item/accordion-item.component.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
</pa-button>
1111
<div class="pa-accordion-item-title">
1212
<div class="title-m">{{ itemTitle }}</div>
13-
<div class="body-s">{{ description }}</div>
13+
<div
14+
class="body-s"
15+
[innerHTML]="description"></div>
1416
</div>
1517
</div>
1618

0 commit comments

Comments
 (0)