Skip to content

Commit 6b46234

Browse files
authored
Create app.js
1 parent b9760e4 commit 6b46234

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/app.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
fetch("buttons.json")
2+
.then(res => res.json())
3+
.then(buttons => {
4+
const root = document.getElementById("buttons");
5+
6+
buttons.forEach(btn => {
7+
const card = document.createElement("div");
8+
card.className = "button-card";
9+
10+
card.innerHTML = `
11+
<h3>${btn.name}</h3>
12+
<p>by ${btn.author}</p>
13+
<button class="${btn.class}">Click me</button>
14+
`;
15+
16+
root.appendChild(card);
17+
});
18+
});

0 commit comments

Comments
 (0)