Skip to content

Commit 5a8aa73

Browse files
committed
feat: sliding tab indicator on server detail page
1 parent aaf3fab commit 5a8aa73

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

public/css/style.css

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,7 @@ tbody tr:hover {
993993

994994
/* ===== TABS ===== */
995995
.tabs {
996+
position: relative;
996997
display: flex;
997998
gap: 4px;
998999
margin-bottom: 24px;
@@ -1008,9 +1009,8 @@ tbody tr:hover {
10081009
font-size: 0.9rem;
10091010
font-weight: 500;
10101011
cursor: pointer;
1011-
border-bottom: 2px solid transparent;
10121012
margin-bottom: -1px;
1013-
transition: color 0.15s, border-color 0.15s;
1013+
transition: color 0.15s;
10141014
}
10151015

10161016
.tab:hover {
@@ -1019,7 +1019,16 @@ tbody tr:hover {
10191019

10201020
.tab.active {
10211021
color: var(--accent-1);
1022-
border-bottom-color: var(--accent-1);
1022+
}
1023+
1024+
.tab-indicator {
1025+
position: absolute;
1026+
bottom: -1px;
1027+
left: 0;
1028+
height: 2px;
1029+
background: var(--accent-1);
1030+
transition: left 0.2s ease, width 0.2s ease;
1031+
pointer-events: none;
10231032
}
10241033

10251034
.tab-content {

public/js/app.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1742,10 +1742,11 @@ async function renderServerDetail(serverId) {
17421742
</div>
17431743
</div>
17441744
1745-
<div class="tabs">
1745+
<div class="tabs" id="server-detail-tabs">
17461746
<button class="tab ${activeTab === 'info' ? 'active' : ''}" data-tab="info">Info</button>
17471747
<button class="tab ${activeTab === 'resources' ? 'active' : ''}" data-tab="resources">Resources</button>
17481748
<button class="tab ${activeTab === 'actions' ? 'active' : ''}" data-tab="actions">Actions</button>
1749+
<div class="tab-indicator" id="tab-indicator"></div>
17491750
</div>
17501751
17511752
<div id="server-tab-info" class="tab-content" style="display:${activeTab === 'info' ? 'block' : 'none'}">
@@ -1878,6 +1879,15 @@ async function renderServerDetail(serverId) {
18781879
fetchLiveResources(s.identifier);
18791880
}
18801881

1882+
requestAnimationFrame(() => {
1883+
const indicator = $('#tab-indicator');
1884+
const activeTabEl = $('#server-detail-tabs .tab.active');
1885+
if (indicator && activeTabEl) {
1886+
indicator.style.left = activeTabEl.offsetLeft + 'px';
1887+
indicator.style.width = activeTabEl.offsetWidth + 'px';
1888+
}
1889+
});
1890+
18811891
} catch (err) {
18821892
el.innerHTML = html`
18831893
<div class="empty-state">

0 commit comments

Comments
 (0)