Better responsive UI, added author field and improved project loading.
This commit is contained in:
parent
ed347bcfca
commit
ea805dbb28
15 changed files with 176 additions and 198 deletions
30
featured.js
Normal file
30
featured.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
const featuredHelper = document.querySelector("#featuredHelper");
|
||||
|
||||
async function getFeaturedJSON() {
|
||||
const response = await fetch(`featured.json`);
|
||||
if (!response.ok) {
|
||||
featuredHelper.innerHTML = `
|
||||
<p>;( Oopsie! Could not load featured projects...</p>
|
||||
`
|
||||
throw new Error("Failed to fetch featured projects JSON");
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
data.forEach(project => {
|
||||
const featuredDiv = document.createElement("div");
|
||||
featuredDiv.classList.add("featuredProject");
|
||||
featuredDiv.id = `featured-${project}`;
|
||||
featuredDiv.innerHTML = `
|
||||
<a href="project.html?id=${project}">
|
||||
<img src="projects/${project}/logo.png">
|
||||
<p>:${project}</p>
|
||||
</a>
|
||||
`;
|
||||
featuredHelper.appendChild(featuredDiv);
|
||||
|
||||
loadProject(project, document.querySelector(`featured-${project} p`), undefined, undefined, undefined, document.querySelector(`featured-${project} img`))
|
||||
});
|
||||
}
|
||||
|
||||
getFeaturedJSON();
|
||||
Loading…
Add table
Add a link
Reference in a new issue