-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
21 lines (21 loc) · 1020 Bytes
/
Copy pathscript.js
File metadata and controls
21 lines (21 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
fetch('projects.json')
.then(response => response.json())
.then(projects => {
const container = document.getElementById('projects');
projects.forEach(project => {
const card = document.createElement('div');
card.className = 'bg-white shadow-md rounded-lg overflow-hidden';
card.innerHTML = `
<img src="${project.thumbnail}" alt="${project.title}" class="w-full h-80 object-cover object-center">
<div class="p-4">
<h1 class="text-2xl font-semibold mb-2">${project.title}</h1>
<p class="text-gray-600 mb-8">${project.description}</p>
<a href="${project.link}" target="_blank" class="text-blue-500 font-medium hover:underline">
View the projects GitHub page
</a>
</div>
`;
container.appendChild(card);
});
})
.catch(error => console.error('Error loading data:', error));