Skip to content

Commit 4d1d881

Browse files
committed
♻️ refactor(UI): 统一组件样式并重构相关 CSS
1 parent d40d982 commit 4d1d881

File tree

1 file changed

+59
-33
lines changed

1 file changed

+59
-33
lines changed

templates/index.html.j2

Lines changed: 59 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,41 @@
268268
gap: 2rem;
269269
}
270270
271+
/* Unified UI Components */
272+
.ui-title {
273+
font-family: 'Plus Jakarta Sans', sans-serif;
274+
font-weight: 600;
275+
word-break: break-all;
276+
color: var(--fg);
277+
}
278+
279+
.ui-meta {
280+
font-family: 'Space Mono', monospace;
281+
font-size: 0.75rem;
282+
color: var(--fg-dim);
283+
}
284+
285+
.ui-meta b { color: var(--fg); font-weight: 700; }
286+
.ui-meta .accent { color: var(--accent); }
287+
288+
.ui-stars {
289+
color: var(--accent);
290+
font-weight: 700;
291+
}
292+
293+
.ui-tag {
294+
font-family: 'Space Mono', monospace;
295+
font-size: 0.7rem;
296+
padding: 0.2rem 0.6rem;
297+
border: 1px solid var(--border);
298+
text-transform: uppercase;
299+
display: inline-flex;
300+
align-items: center;
301+
gap: 0.5rem;
302+
background: var(--surface);
303+
transition: var(--transition);
304+
}
305+
271306
.repo-card {
272307
background: var(--surface);
273308
border: 1px solid var(--border);
@@ -287,18 +322,13 @@
287322
288323
@media (max-width: 600px) {
289324
.repo-card { padding: 1.5rem; }
290-
.card-title { font-size: 1.8rem; }
325+
.card-title { font-size: 1.5rem; }
291326
}
292327
293328
.card-lang {
294-
font-family: 'Space Mono', monospace;
295-
font-size: 0.7rem;
296-
text-transform: uppercase;
297-
color: var(--accent);
298329
margin-bottom: 1.5rem;
299-
display: flex;
300-
align-items: center;
301-
gap: 0.5rem;
330+
color: var(--accent);
331+
border-color: var(--accent-soft);
302332
}
303333
304334
.card-lang::before {
@@ -310,12 +340,9 @@
310340
}
311341
312342
.card-title {
313-
font-family: 'Plus Jakarta Sans', sans-serif;
314343
font-size: 1.4rem;
315-
font-weight: 600;
316344
margin-bottom: 1rem;
317345
line-height: 1.3;
318-
word-break: break-all;
319346
}
320347
321348
.card-desc {
@@ -334,14 +361,10 @@
334361
display: flex;
335362
justify-content: space-between;
336363
align-items: center;
337-
font-family: 'Space Mono', monospace;
338-
font-size: 0.75rem;
339364
border-top: 1px solid var(--border);
340365
padding-top: 1.5rem;
341366
}
342367
343-
.card-stars { color: var(--fg); font-weight: 700; }
344-
345368
/* Modal */
346369
.modal {
347370
position: fixed;
@@ -389,11 +412,16 @@
389412
.modal-close:hover { color: var(--accent); }
390413
391414
.modal-title {
392-
font-family: 'Plus Jakarta Sans', sans-serif;
393415
font-size: 2.5rem;
394-
font-weight: 600;
395416
line-height: 1.2;
396-
margin-bottom: 2rem;
417+
margin-bottom: 1rem;
418+
}
419+
420+
.modal-meta-group {
421+
display: flex;
422+
gap: 2rem;
423+
align-items: center;
424+
margin-bottom: 1.5rem;
397425
}
398426
399427
.modal-section { margin-bottom: 3rem; }
@@ -421,14 +449,11 @@
421449
.topic-list {
422450
display: flex;
423451
flex-wrap: wrap;
424-
gap: 0.5rem;
452+
gap: 0.6rem;
425453
}
426454
427455
.topic-tag {
428-
font-family: 'Space Mono', monospace;
429456
font-size: 0.75rem;
430-
padding: 0.3rem 0.6rem;
431-
border: 1px solid var(--border);
432457
}
433458
434459
.modal-actions {
@@ -669,11 +694,11 @@
669694

670695
<div class="modal-section modal-header-info">
671696
<div>
672-
<div id="m-lang" class="card-lang" style="margin-bottom: 1rem;"></div>
673-
<h2 id="m-name" class="modal-title" style="margin-bottom: 0.5rem;"></h2>
674-
<div style="display: flex; gap: 2rem; align-items: center; margin-bottom: 1.5rem; font-family: 'Space Mono', monospace; font-size: 0.9rem;">
675-
<div id="m-stars" style="color: var(--accent); font-weight: 700; font-size: 1.2rem;"></div>
676-
<div id="m-updated" style="color: var(--fg-dim);"></div>
697+
<div id="m-lang" class="ui-tag card-lang" style="margin-bottom: 1rem;"></div>
698+
<h2 id="m-name" class="ui-title modal-title"></h2>
699+
<div class="modal-meta-group ui-meta">
700+
<div id="m-stars" class="ui-stars" style="font-size: 1rem;"></div>
701+
<div id="m-updated"></div>
677702
</div>
678703
<div id="m-topics" class="topic-list"></div>
679704
</div>
@@ -760,11 +785,11 @@
760785
const summary = item.summary[currentLang] || item.summary.zh || texts.no_sum;
761786
762787
card.innerHTML = `
763-
<div class="card-lang">${item.language || 'DATA'}</div>
764-
<h2 class="card-title">${item.full_name}</h2>
788+
<div class="card-lang ui-tag">${item.language || 'DATA'}</div>
789+
<h2 class="card-title ui-title">${item.full_name}</h2>
765790
<p class="card-desc">${summary}</p>
766-
<div class="card-footer">
767-
<span class="card-stars">☆ ${item.stars}</span>
791+
<div class="card-footer ui-meta">
792+
<span class="ui-stars">☆ ${item.stars}</span>
768793
<span>${texts.updated}: ${item.updated_at}</span>
769794
</div>
770795
`;
@@ -841,7 +866,7 @@
841866
topicsContainer.innerHTML = '';
842867
(item.topics || []).forEach(t => {
843868
const span = document.createElement('span');
844-
span.className = 'topic-tag';
869+
span.className = 'ui-tag topic-tag';
845870
span.textContent = t.toUpperCase();
846871
topicsContainer.appendChild(span);
847872
});
@@ -855,8 +880,9 @@
855880
856881
tags.forEach(t => {
857882
const span = document.createElement('span');
858-
span.className = 'topic-tag';
883+
span.className = 'ui-tag topic-tag';
859884
span.style.borderColor = 'var(--accent)';
885+
span.style.color = 'var(--accent)';
860886
span.textContent = `#${t.toUpperCase()}`;
861887
tagsContainer.appendChild(span);
862888
});

0 commit comments

Comments
 (0)