Skip to content

Commit 46e7642

Browse files
authored
Create main.js
1 parent 4ffc0ef commit 46e7642

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

Member/ruk-zh4n/assets/js/main.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { socialLinks, techStack, projects } from './data.js';
2+
3+
// Social Links Render
4+
const socialGrid = document.getElementById('social-grid');
5+
if (socialGrid) {
6+
socialLinks.forEach(link => {
7+
const isWide = link.size === 'wide';
8+
const classes = isWide
9+
? "card md:col-span-2 rounded-2xl p-5 flex items-center justify-between group"
10+
: "card rounded-2xl p-5 flex flex-col justify-between h-32 md:h-auto group";
11+
12+
const content = isWide
13+
? `
14+
<div class="flex items-center gap-4">
15+
<div class="w-10 h-10 rounded-full bg-white/5 flex items-center justify-center ${link.color}">
16+
<i class="${link.icon} text-lg"></i>
17+
</div>
18+
<div><h3 class="font-bold text-white">${link.name}</h3><p class="text-xs text-slate-500">${link.desc}</p></div>
19+
</div>
20+
<i class="fas fa-chevron-right text-slate-600 group-hover:translate-x-1 transition-transform"></i>
21+
`
22+
: `
23+
<div class="flex justify-between items-start">
24+
<i class="${link.icon} text-2xl ${link.color}"></i>
25+
<i class="fas fa-arrow-up-right text-xs text-slate-600 group-hover:text-white transition-colors"></i>
26+
</div>
27+
<div><h3 class="font-bold text-white">${link.name}</h3><p class="text-xs text-slate-500">${link.desc}</p></div>
28+
`;
29+
30+
const a = document.createElement('a');
31+
a.href = link.url;
32+
a.target = "_blank";
33+
a.className = classes;
34+
a.innerHTML = content;
35+
socialGrid.appendChild(a);
36+
});
37+
}
38+
39+
// Tech Stack Render
40+
const techContainer = document.getElementById('tech-stack');
41+
if (techContainer) {
42+
techStack.forEach(tech => {
43+
const span = document.createElement('span');
44+
span.className = `tech-badge ${tech.color}`;
45+
span.innerHTML = `<i class="${tech.icon}"></i> ${tech.name}`;
46+
techContainer.appendChild(span);
47+
});
48+
}
49+
50+
// Projects Render
51+
const projectGrid = document.getElementById('project-grid');
52+
if (projectGrid) {
53+
projects.forEach(proj => {
54+
const colorClass = proj.color === 'orange' ? 'text-orange-400' : 'text-blue-400';
55+
const bgClass = proj.color === 'orange' ? 'bg-orange-500/10' : 'bg-blue-500/10';
56+
const borderClass = proj.color === 'orange' ? 'border-orange-500/20' : 'border-blue-500/20';
57+
58+
const a = document.createElement('a');
59+
a.href = proj.url;
60+
a.target = "_blank";
61+
a.className = "card p-6 rounded-2xl group block";
62+
a.innerHTML = `
63+
<div class="flex items-center gap-2 mb-4">
64+
<span class="text-[10px] font-bold px-2 py-1 rounded ${bgClass} ${colorClass} border ${borderClass} uppercase">${proj.category}</span>
65+
<span class="text-[10px] text-slate-500">${proj.date}</span>
66+
</div>
67+
<h3 class="text-xl font-bold text-white group-hover:${colorClass} transition-colors">${proj.title}</h3>
68+
<p class="text-slate-400 text-sm mt-2">${proj.desc}</p>
69+
`;
70+
projectGrid.appendChild(a);
71+
});
72+
}

0 commit comments

Comments
 (0)