Skip to content

Commit 46b5aad

Browse files
committed
update web component to observe highlight card attributes
1 parent caf726a commit 46b5aad

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

ims-education.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
desc="<p>Get comprehensive IMS™ education by taking these self-paced, digital courses.</p><p style='font-weight: 300;'>You can also earn a digital badge!</p>"
9090
linktext="Sign up for an IBM ID →"
9191
link="https://login.ibm.com/authsvc/mtfim/sps/authsvc?PolicyId=urn:ibm:security:authentication:asf:basicldapuser&Target=https%3A%2F%2Flogin.ibm.com%2Foidc%2Fendpoint%2Fdefault%2Fauthorize%3FqsId%3D9fe3fe66-c22f-4c7b-8e5d-01dfc0e8defa%26client_id%3DMyIBMDallasProdCI"
92+
highlight="Implementing IMS Security"
93+
highlightlink="#ims-security"
9294
></hero-section>
9395

9496
<!-- =========================== New courses CTA =========================== -->

web-components/hero-section/hero-section.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ <h2 class="name"></h2>
2222
<img src="../../wp-content/icons/icon_event.svg" alt="">
2323
<h3>Coming soon</h3>
2424
</div>
25-
<h2 class="highlight">Implementing IMS Security</h2>
26-
<a class="highlight-link" rel="noopener noreferrer" href="#ims-security">See details</a>
25+
<h2 class="highlight"></h2>
26+
<a class="highlight-link" rel="noopener noreferrer">See details</a>
2727
</div>
2828
</div>
2929
</section>

web-components/hero-section/hero-section.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function createComponent(html) {
4646

4747
// Return array of properties to observe
4848
static get observedAttributes() {
49-
return ['name', 'image', 'section', 'desc', 'linktext', 'link', 'linktext2', 'link2'];
49+
return ['name', 'image', 'section', 'desc', 'linktext', 'link', 'linktext2', 'link2', 'highlight', 'highlightlink'];
5050
}
5151

5252
// Called when an attribute is defined or changed
@@ -73,6 +73,14 @@ function createComponent(html) {
7373
img.classList.add('large-icon');
7474
}
7575

76+
if (this.highlight != undefined) {
77+
setContent('.highlight', this.highlight, shadow);
78+
setLink('.highlight-link', this.highlightlink, shadow);
79+
} else {
80+
const highlightCard = shadow.querySelector('.highlight-card');
81+
highlightCard.style.display = 'none';
82+
}
83+
7684
const heroSection = shadow.querySelector('.hero-section');
7785
const hero = shadow.querySelector('.hero');
7886

0 commit comments

Comments
 (0)