-
Notifications
You must be signed in to change notification settings - Fork 0
/
app1.js
29 lines (25 loc) · 934 Bytes
/
app1.js
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
const fetchData = async () => {
try {
const response = await fetch("https://api.github.com/repos/johngagefaulkner/Icons-and-Logos/contents/src/svg/Microsoft/Azure/Azure-Public-Service-Icons-v18");
const data = await response.json();
return data;
} catch (error) {
console.error("Error fetching data:", error);
}
};
const displayImages = (images) => {
const imageContainer = document.getElementById("image-container");
images.forEach((image) => {
const imageCard = document.createElement("div");
imageCard.className = "image-card";
const img = document.createElement("img");
img.src = image.download_url
img.style.width = "100%";
imageCard.appendChild(img);
imageContainer.appendChild(imageCard);
});
};
(async () => {
const images = await fetchData();
displayImages(images);
})();