Skip to content

Commit ef67396

Browse files
committed
update course description with live designation
1 parent 4fdfb75 commit ef67396

3 files changed

Lines changed: 29 additions & 44 deletions

File tree

web-components/course-card/course-card.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ img {
4848
.inline-g p {
4949
padding: 0em;
5050
margin: 0em;
51-
font-weight: bold;
51+
/* font-weight: bold; */
5252
}
5353

54-
.inline-g span {
54+
/* .inline-g span {
5555
font-weight: normal;
56-
}
56+
} */
5757

5858
/* Styling for course card */
5959
.course-card {

web-components/course-card/course-card.html

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,16 @@ <h2 class="course-name"></h2>
1010
<p class="course-desc"></p>
1111
<div class="column-g">
1212
<div class="inline-g">
13-
<p>Level: <span class="course-level"></span></p>
14-
<p>Cost: <span class="course-cost"></span></p>
15-
<p>Badge: <span class="course-badge"></span></p>
16-
<p>Time: <span class="course-time"></span></p>
17-
</div>
18-
<!-- Uncomment if using self-paced/live distinction -->
19-
<!-- <div class="inline-g">
20-
<p>Self-paced:</p>
21-
<div>
22-
<p>Level: <span class="course-level"></span></p>
23-
<p>Cost: <span class="course-cost"></span></p>
24-
<p>Badge: <span class="course-badge"></span></p>
25-
<p>Time: <span class="course-time"></span></p>
26-
</div>
27-
</div> -->
28-
<div class="inline-g live-course">
29-
<p>Instructor-led:</p>
30-
<div>
31-
<p>Level: <span class="live-level"></span></p>
32-
<p>Cost: <span class="live-cost"></span></p>
33-
<p>Badge: <span class="live-badge"></span></p>
34-
<p>Time: <span class="live-time"></span></p>
35-
</div>
13+
<p><b><span class="course-type"></span></b> Yes</p>
14+
<p><b>Level: </b><span class="course-level"></span></p>
15+
<p><b>Cost: </b><span class="course-cost"></span></p>
16+
<p><b>Badge: </b><span class="course-badge"></span></p>
17+
<p><b>Time: </b><span class="course-time"></span></p>
3618
</div>
3719
</div>
3820
</div>
3921
<div class="link-g">
4022
<a class="course-link" target="_blank" rel="noopener noreferrer">Learn more →</a>
41-
<a class="live-link" target="_blank" rel="noopener noreferrer">Instructor-led course →</a>
4223
</div>
4324
</div>
4425
</div>

web-components/course-card/course-card.js

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ function createComponent(html) {
2323
// Creates element with default values
2424
constructor() {
2525
super();
26+
this.selfpaced = 'true';
2627
}
2728

2829
// Return array of properties to observe
2930
static get observedAttributes() {
30-
return ['name', 'desc', 'imgsrc', 'level', 'cost', 'badge', 'time', 'link', 'livelevel', 'livecost', 'livebadge', 'livetime', 'livelink'];
31+
return ['name', 'desc', 'imgsrc', 'selfpaced', 'level', 'cost', 'badge', 'time', 'link'];
3132
}
3233

3334
// Called when an attribute is defined or changed
@@ -53,6 +54,9 @@ function createComponent(html) {
5354
setContent('.course-desc', this.desc, shadow);
5455
// Set course level
5556
setContent('.course-level', this.level, shadow);
57+
// Set course type
58+
const courseType = this.selfpaced == 'true' ? 'Self-paced: ' : 'Instructor-led: ';
59+
setContent('.course-type', courseType, shadow);
5660
// Set course cost
5761
setContent('.course-cost', this.cost, shadow);
5862
// Set course badge
@@ -63,22 +67,22 @@ function createComponent(html) {
6367
setLink('.course-link', this.link, this.name, shadow);
6468

6569
// Hide live course if not available
66-
if (this.livelevel == undefined) {
67-
const liveCourse = shadow.querySelector('.live-course');
68-
const liveCourseLink = shadow.querySelector('.live-link');
69-
liveCourse.style.display = liveCourseLink.style.display = "none";
70-
} else {
71-
// Set course level
72-
setContent('.live-level', this.livelevel, shadow);
73-
// Set course cost
74-
setContent('.live-cost', this.livecost, shadow);
75-
// Set course badge
76-
setContent('.live-badge', this.livebadge, shadow);
77-
// Set course time
78-
setContent('.live-time', this.livetime, shadow);
79-
// Set course link
80-
setLink('.live-link', this.livelink, this.name, shadow);
81-
}
70+
// if (this.livelevel == undefined) {
71+
// const liveCourse = shadow.querySelector('.live-course');
72+
// const liveCourseLink = shadow.querySelector('.live-link');
73+
// liveCourse.style.display = liveCourseLink.style.display = "none";
74+
// } else {
75+
// // Set course level
76+
// setContent('.live-level', this.livelevel, shadow);
77+
// // Set course cost
78+
// setContent('.live-cost', this.livecost, shadow);
79+
// // Set course badge
80+
// setContent('.live-badge', this.livebadge, shadow);
81+
// // Set course time
82+
// setContent('.live-time', this.livetime, shadow);
83+
// // Set course link
84+
// setLink('.live-link', this.livelink, this.name, shadow);
85+
// }
8286
}
8387
}
8488

0 commit comments

Comments
 (0)