-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
72 lines (65 loc) · 2.08 KB
/
script.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Array of projects with projectCount number, project name, and link
const projects = [
{
projectCount: "1",
name: "Random Fact Generator",
location: "01 - Random Fact Generator",
},
{
projectCount: "2",
name: "Random Joke Generator",
location: "02 - Random Joke Generator",
},
{
projectCount: "3",
name: "Random Pic Generator",
location: "03 - Random Pic Generator",
},
{
projectCount: "4",
name: "Random Color Generator",
location: "04 - Random Color Generator",
},
{
projectCount: "5",
name: "Simple Text Editor",
location: "05 - Simple Text Editor",
},
{
projectCount: "6",
name: "Simple Landing Page",
location: "06 - Simple Landing Page",
},
{
projectCount: "7",
name: "ToDo App",
location: "07 - ToDo App",
},
{
projectCount: "8",
name: "Simon Says Game",
location: "08 - Simon Says Game",
},
// Add more projects as needed
];
// Function to generate and display project cards
function displayProjects() {
const container = document.querySelector(".cards");
projects.forEach((project) => {
const card = document.createElement("div");
card.className = "card";
const title = document.createElement("h2");
title.textContent = `Mini Project - ${project.projectCount}`;
card.appendChild(title);
const projectName = document.createElement("h3");
projectName.textContent = project.name;
card.appendChild(projectName);
const viewProjectLink = document.createElement("a");
viewProjectLink.href = `${project.location}/index.html`;
viewProjectLink.textContent = "View Live Preview";
card.appendChild(viewProjectLink);
container.appendChild(card);
});
}
// Initialize the project display when the DOM is fully loaded
document.addEventListener("DOMContentLoaded", displayProjects);