Skip to content

Commit 7a99e30

Browse files
Change output.css link method
1 parent 28ba47b commit 7a99e30

File tree

3 files changed

+139
-104
lines changed

3 files changed

+139
-104
lines changed

src/index.html

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,8 @@
306306
}
307307
</style>
308308

309-
<link
310-
rel="stylesheet"
311-
href="./output.css"
312-
media="print"
313-
onload="this.media='all'"
314-
/>
315-
<noscript><link rel="stylesheet" href="./output.css" /></noscript>
309+
<link rel="preload" href="./output.css" as="style" />
310+
<link rel="stylesheet" href="./output.css" />
316311

317312
<script>
318313
document.addEventListener("DOMContentLoaded", function () {

src/js/generator.js

Lines changed: 93 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,55 @@ import { techStackData, certificatesData } from './data.js';
44

55
// Function to initialize everything
66
function initializeContent() {
7-
renderTechStack();
8-
renderCertificates();
9-
setupLazyLoading();
7+
renderTechStack();
8+
renderCertificates();
9+
setupLazyLoading();
1010
}
1111

1212
// Tech Stack Generator Functions
1313
function renderTechStack() {
14-
// For mobile view
15-
const mobileContainer = document.querySelector('.block.md\\:hidden.space-y-6');
16-
if (mobileContainer) {
17-
techStackData.categories.forEach(category => {
18-
// Create category heading
19-
const categoryHeading = document.createElement('div');
20-
categoryHeading.className = 'mb-8';
21-
categoryHeading.innerHTML = `
14+
// For mobile view
15+
const mobileContainer = document.querySelector('.block.md\\:hidden.space-y-6');
16+
if (mobileContainer) {
17+
techStackData.categories.forEach(category => {
18+
// Create category heading
19+
const categoryHeading = document.createElement('div');
20+
categoryHeading.className = 'mb-8';
21+
categoryHeading.innerHTML = `
2222
<h3 class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400 px-4 py-3 mb-3 rounded-t-lg">
2323
${category.name}
2424
</h3>
2525
`;
2626

27-
// Create skill cards for this category
28-
category.skills.forEach(skill => {
29-
const skillCard = createMobileSkillCard(skill);
30-
categoryHeading.appendChild(skillCard);
31-
});
32-
33-
mobileContainer.appendChild(categoryHeading);
34-
});
35-
}
36-
37-
// For desktop view (table)
38-
const tableBody = document.getElementById('tech-desktop-table');
39-
if (tableBody) {
40-
techStackData.categories.forEach(category => {
41-
let tableHead = createDesktopSkillHead(category)
42-
tableBody.insertAdjacentHTML('beforeend', tableHead)
43-
category.skills.forEach(skill => {
44-
const skillRow = createDesktopSkillRow(skill);
45-
tableBody.appendChild(skillRow);
46-
});
47-
});
48-
}
27+
// Create skill cards for this category
28+
category.skills.forEach(skill => {
29+
const skillCard = createMobileSkillCard(skill);
30+
categoryHeading.appendChild(skillCard);
31+
});
32+
33+
mobileContainer.appendChild(categoryHeading);
34+
});
35+
}
36+
37+
// For desktop view (table)
38+
const tableBody = document.getElementById('tech-desktop-table');
39+
if (tableBody) {
40+
techStackData.categories.forEach(category => {
41+
let tableHead = createDesktopSkillHead(category)
42+
tableBody.insertAdjacentHTML('beforeend', tableHead)
43+
category.skills.forEach(skill => {
44+
const skillRow = createDesktopSkillRow(skill);
45+
tableBody.appendChild(skillRow);
46+
});
47+
});
48+
}
4949
}
5050

5151
function createMobileSkillCard(skill) {
52-
const card = document.createElement('div');
53-
card.className = 'bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg mb-4 overflow-hidden shadow-sm';
52+
const card = document.createElement('div');
53+
card.className = 'bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg mb-4 overflow-hidden shadow-sm';
5454

55-
card.innerHTML = `
55+
card.innerHTML = `
5656
<div class="px-4 py-3 border-b border-gray-200 dark:border-gray-700">
5757
<div class="flex items-center gap-3">
5858
<img src="${skill.icon}" alt="${skill.name}" title="${skill.name}" class="w-6 h-6" />
@@ -86,11 +86,11 @@ function createMobileSkillCard(skill) {
8686
</div>
8787
`;
8888

89-
return card;
89+
return card;
9090
}
9191

9292
function createDesktopSkillHead(category) {
93-
let html = `<thead class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400 rounded-md">
93+
let html = `<thead class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400 rounded-md">
9494
<tr>
9595
<th scope="col" class="px-6 py-3">${category.name}</th>
9696
<th scope="col" class="px-6 py-3">Proficiency</th>
@@ -99,14 +99,14 @@ function createDesktopSkillHead(category) {
9999
</tr>
100100
</thead>`
101101

102-
return html;
102+
return html;
103103
}
104104

105105
function createDesktopSkillRow(skill) {
106-
const row = document.createElement('tr');
107-
row.className = 'bg-white border-b dark:bg-gray-800 dark:border-gray-700 border-gray-200';
106+
const row = document.createElement('tr');
107+
row.className = 'bg-white border-b dark:bg-gray-800 dark:border-gray-700 border-gray-200';
108108

109-
row.innerHTML = `
109+
row.innerHTML = `
110110
<th scope="row" class="flex flex-row items-center gap-3 px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white">
111111
<img src="${skill.icon}" alt="${skill.name}" title="${skill.name}" class="w-6 h-6" />
112112
${skill.fullName}
@@ -136,29 +136,29 @@ function createDesktopSkillRow(skill) {
136136
</td>
137137
`;
138138

139-
return row;
139+
return row;
140140
}
141141

142142
// Certificate Generator Functions
143143
function renderCertificates() {
144-
const certificatesContainer = document.querySelector('.certificates-cards');
145-
if (certificatesContainer) {
146-
// Clear existing certificates if any
147-
certificatesContainer.innerHTML = '';
148-
149-
// Generate certificate cards
150-
certificatesData.forEach(cert => {
151-
const certCard = createCertificateCard(cert);
152-
certificatesContainer.appendChild(certCard);
153-
});
154-
}
144+
const certificatesContainer = document.querySelector('.certificates-cards');
145+
if (certificatesContainer) {
146+
// Clear existing certificates if any
147+
certificatesContainer.innerHTML = '';
148+
149+
// Generate certificate cards
150+
certificatesData.forEach(cert => {
151+
const certCard = createCertificateCard(cert);
152+
certificatesContainer.appendChild(certCard);
153+
});
154+
}
155155
}
156156

157157
function createCertificateCard(cert) {
158-
const card = document.createElement('div');
159-
card.className = 'certificates-card flex flex-col justify-between items-center gap-3 bg-primary p-5 border-2 border-priGray rounded-3xl shadow-btn max-w-80';
158+
const card = document.createElement('div');
159+
card.className = 'certificates-card flex flex-col justify-between items-center gap-3 bg-primary p-5 border-2 border-priGray rounded-3xl shadow-btn max-w-80';
160160

161-
card.innerHTML = `
161+
card.innerHTML = `
162162
<div class="cer-picture w-full h-full">
163163
<div class="spinner flex justify-center items-center w-full h-full place-items-center">
164164
<div role="status">
@@ -192,48 +192,48 @@ function createCertificateCard(cert) {
192192
</div>
193193
`;
194194

195-
return card;
195+
return card;
196196
}
197197

198198
// Setup lazy loading for certificate images
199199
function setupLazyLoading() {
200-
// Check if IntersectionObserver is supported
201-
if ('IntersectionObserver' in window) {
202-
const lazyImages = document.querySelectorAll('img.lazy');
203-
204-
const imageObserver = new IntersectionObserver((entries, observer) => {
205-
entries.forEach(entry => {
206-
if (entry.isIntersecting) {
207-
const img = entry.target;
208-
img.src = img.dataset.src;
209-
210-
// Show image after it's loaded
211-
img.onload = () => {
212-
img.classList.remove('opacity-0');
213-
img.classList.add('opacity-100');
214-
215-
// Hide spinner when image loads
216-
const spinner = img.parentElement.querySelector('.spinner');
217-
if (spinner) {
218-
spinner.style.display = 'none';
219-
}
220-
};
221-
222-
imageObserver.unobserve(img);
223-
}
224-
});
225-
});
226-
227-
lazyImages.forEach(img => imageObserver.observe(img));
228-
} else {
229-
// Fallback for browsers that don't support IntersectionObserver
230-
const lazyImages = document.querySelectorAll('img.lazy');
231-
lazyImages.forEach(img => {
232-
img.src = img.dataset.src;
200+
// Check if IntersectionObserver is supported
201+
if ('IntersectionObserver' in window) {
202+
const lazyImages = document.querySelectorAll('img.lazy');
203+
204+
const imageObserver = new IntersectionObserver((entries, observer) => {
205+
entries.forEach(entry => {
206+
if (entry.isIntersecting) {
207+
const img = entry.target;
208+
img.src = img.dataset.src;
209+
210+
// Show image after it's loaded
211+
img.onload = () => {
233212
img.classList.remove('opacity-0');
234213
img.classList.add('opacity-100');
235-
});
236-
}
214+
215+
// Hide spinner when image loads
216+
const spinner = img.parentElement.querySelector('.spinner');
217+
if (spinner) {
218+
spinner.style.display = 'none';
219+
}
220+
};
221+
222+
imageObserver.unobserve(img);
223+
}
224+
});
225+
});
226+
227+
lazyImages.forEach(img => imageObserver.observe(img));
228+
} else {
229+
// Fallback for browsers that don't support IntersectionObserver
230+
const lazyImages = document.querySelectorAll('img.lazy');
231+
lazyImages.forEach(img => {
232+
img.src = img.dataset.src;
233+
img.classList.remove('opacity-0');
234+
img.classList.add('opacity-100');
235+
});
236+
}
237237
}
238238

239239
// Run initialization when DOM is fully loaded

src/output.css

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,14 +1628,14 @@ body::-webkit-scrollbar-thumb {
16281628
width: 4.5rem;
16291629
}
16301630

1631-
.w-full {
1632-
width: 100%;
1633-
}
1634-
16351631
.w-auto {
16361632
width: auto;
16371633
}
16381634

1635+
.w-full {
1636+
width: 100%;
1637+
}
1638+
16391639
.min-w-64 {
16401640
min-width: 16rem;
16411641
}
@@ -1920,6 +1920,16 @@ body::-webkit-scrollbar-thumb {
19201920
background-color: rgb(234 179 8 / var(--tw-bg-opacity, 1));
19211921
}
19221922

1923+
.bg-green-100 {
1924+
--tw-bg-opacity: 1;
1925+
background-color: rgb(220 252 231 / var(--tw-bg-opacity, 1));
1926+
}
1927+
1928+
.bg-blue-100 {
1929+
--tw-bg-opacity: 1;
1930+
background-color: rgb(219 234 254 / var(--tw-bg-opacity, 1));
1931+
}
1932+
19231933
.bg-gradient-to-b {
19241934
background-image: linear-gradient(to bottom, var(--tw-gradient-stops));
19251935
}
@@ -2153,6 +2163,16 @@ body::-webkit-scrollbar-thumb {
21532163
color: rgb(255 255 255 / 0.6);
21542164
}
21552165

2166+
.text-green-800 {
2167+
--tw-text-opacity: 1;
2168+
color: rgb(22 101 52 / var(--tw-text-opacity, 1));
2169+
}
2170+
2171+
.text-blue-800 {
2172+
--tw-text-opacity: 1;
2173+
color: rgb(30 64 175 / var(--tw-text-opacity, 1));
2174+
}
2175+
21562176
.underline-offset-2 {
21572177
text-underline-offset: 2px;
21582178
}
@@ -2365,6 +2385,16 @@ body::-webkit-scrollbar-thumb {
23652385
background-color: rgb(31 41 55 / var(--tw-bg-opacity, 1));
23662386
}
23672387

2388+
.dark\:bg-green-900:is(.dark *) {
2389+
--tw-bg-opacity: 1;
2390+
background-color: rgb(20 83 45 / var(--tw-bg-opacity, 1));
2391+
}
2392+
2393+
.dark\:bg-blue-900:is(.dark *) {
2394+
--tw-bg-opacity: 1;
2395+
background-color: rgb(30 58 138 / var(--tw-bg-opacity, 1));
2396+
}
2397+
23682398
.dark\:text-gitWhite:is(.dark *) {
23692399
--tw-text-opacity: 1;
23702400
color: rgb(255 255 255 / var(--tw-text-opacity, 1));
@@ -2390,6 +2420,16 @@ body::-webkit-scrollbar-thumb {
23902420
color: rgb(255 255 255 / var(--tw-text-opacity, 1));
23912421
}
23922422

2423+
.dark\:text-green-300:is(.dark *) {
2424+
--tw-text-opacity: 1;
2425+
color: rgb(134 239 172 / var(--tw-text-opacity, 1));
2426+
}
2427+
2428+
.dark\:text-blue-300:is(.dark *) {
2429+
--tw-text-opacity: 1;
2430+
color: rgb(147 197 253 / var(--tw-text-opacity, 1));
2431+
}
2432+
23932433
.dark\:shadow-none:is(.dark *) {
23942434
--tw-shadow: 0 0 #0000;
23952435
--tw-shadow-colored: 0 0 #0000;

0 commit comments

Comments
 (0)