-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadaptations.js
More file actions
52 lines (48 loc) · 1.75 KB
/
adaptations.js
File metadata and controls
52 lines (48 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// the div in which to put the adaptations
const adaptationsDisplay = document.getElementById("adaptations-display");
function printAdaptations() {
//loops through all adaptations
adaptations.forEach((el, index) => {
//assigns id to adaptation
el.id = index;
//create html that displays adaptaion
const html = `<div id="sherlock-${
el.id
}" class="card px-0 mx-2 my-2 adaptation">
<div class="img-container">
<img
src=${el.img}
alt=""
class="card-img-top"
/>
<a href="${el.imdb}" target="_blank">imdb</a>
</div>
<div class="card-body">
<h4 class="card-title">${el.title}</h4>
<p class="card-text">
${el.description}
</p>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">
<h5 class="starring-header">Starring</h5>
<p class="starring-actors">
${el.actors.map((act) => act.actor).join(", ")}
</p>
</li>
<li class="list-group-item">
<h5 class="director-header">Director/Creator</h5>
<p class="director">${
typeof el.director === "string"
? el.director
: el.director.join(", ")
}</p>
</li>
</ul>
</div>`;
// insert adaptaion-element
adaptationsDisplay.insertAdjacentHTML("beforeend", html);
});
}
//call printing function
printAdaptations();