forked from avinash201199/Login-Signup-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
67 lines (58 loc) · 1.85 KB
/
script.js
File metadata and controls
67 lines (58 loc) · 1.85 KB
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
// A list of all the template folder names.
const templateFolders = [
"Abhinav Shukla",
"Amit Raj Sharm",
"Avinash",
"Ayush",
"Baveja Template",
"Bootsnipp",
"CodePenTemplate-1",
"Coding Nepal",
"colorlib Template",
"Dhruva Bhat",
"Foolish Developer",
"Ivan Grozdic",
"Modern Animated Template",
"SaurabhMishra(edtech+ecommerce)",
"Tech Zero",
"Template 1",
"Template 2"
];
// A list of only the templates that were working.
const workingTemplates = [
"SaurabhMishra(edtech+ecommerce)",
"CodePenTemplate-1",
"Bootsnipp",
"Ayush",
"Avinash"
];
//container element from the HTML
const cardContainer = document.getElementById('card-container');
// Loop through each folder name and creating a card for it
templateFolders.forEach(folderName => {
// Create the HTML elements for the card
const card = document.createElement('a');
card.classList.add('template-card');
// Special fix for 'Tech Zero' link
if (folderName === "Tech Zero") {
card.href = `./${folderName}/login.html`;
} else {
card.href = `./${folderName}/`;
}
const screenshot = document.createElement('img');
// Checking if the template is in our "working" list
if (workingTemplates.includes(folderName)) {
// If it works, use your real screenshot
screenshot.src = `./screenshots/${folderName}.png`;
} else {
// If it's broken, using a professional placeholder
screenshot.src = `https://placehold.co/400x300/2d3436/dfe6e9/png?text=Preview+Not+Available`;
}
const title = document.createElement('h3');
title.textContent = folderName;
// Adding the screenshot and title to the card
card.appendChild(screenshot);
card.appendChild(title);
// Adding the completed card to the container
cardContainer.appendChild(card);
});