fix(dashboard): 快捷导航折叠成面板 + 三栏首行统一行高对齐

- 左栏五项导航收进 <details> 折叠面板(默认收起,只占 34px 一行)
- 引入 --qq-row:34px:快捷导航 / 问候标题 / 卡片头 同高同基线,三栏顶部对齐
- .qq-dash-hello 改 flex 垂直居中,去掉大字号带来的基线偏移
- preview/dashboard.html 同步结构,并加 ?probe=1 几何量尺
This commit is contained in:
QQ 2026-11-03 10:52:31 +08:00
parent 64699d5b7b
commit 440764add8
3 changed files with 121 additions and 20 deletions

View File

@ -247,6 +247,8 @@
}
.qq-dash-shell {
/* 三栏第一行(左:快捷导航 / 中:问候 / 右:卡片头)统一行高,保证顶部对齐 */
--qq-row: 34px;
max-width: 1400px;
margin: 0 auto;
padding: 26px 24px 90px;
@ -265,18 +267,67 @@
top: 16px;
}
/* 左栏折叠面板:默认收起,只占一行,点开才展开五个链接 */
.qq-quicknav {
margin-bottom: 18px;
border: 1px solid var(--color-secondary);
border-radius: 10px;
background: var(--color-box-body);
overflow: hidden;
}
.qq-quicknav > summary {
display: flex;
align-items: center;
gap: 8px;
box-sizing: border-box;
min-height: var(--qq-row, 34px);
padding: 0 12px;
cursor: pointer;
font-size: 13px;
font-weight: 600;
color: var(--color-text);
list-style: none;
user-select: none;
}
.qq-quicknav > summary::-webkit-details-marker {
display: none;
}
.qq-quicknav > summary:hover {
color: var(--color-primary);
}
.qq-quicknav .qq-quicknav-chev {
margin-left: auto;
color: var(--color-text-light-2);
transition: transform 0.18s ease;
}
.qq-quicknav[open] > summary {
border-bottom: 1px solid var(--color-secondary);
}
.qq-quicknav[open] .qq-quicknav-chev {
transform: rotate(180deg);
}
.qq-dash-nav {
display: flex;
flex-direction: column;
gap: 2px;
margin-bottom: 22px;
gap: 1px;
margin: 0;
padding: 5px 6px 7px;
}
.qq-dash-nav .item {
display: flex;
align-items: center;
gap: 9px;
padding: 8px 10px;
box-sizing: border-box;
min-height: 32px;
padding: 0 10px;
border-radius: 8px;
font-size: 13.5px;
color: var(--color-text);
@ -340,9 +391,15 @@
/* 中栏 */
.qq-dash-hello {
margin: 2px 0 16px;
font-size: 25px;
display: flex;
align-items: center;
flex-wrap: wrap;
box-sizing: border-box;
min-height: var(--qq-row, 34px);
margin: 0 0 16px;
font-size: 24px;
font-weight: 650;
line-height: 1.2;
letter-spacing: -0.01em;
color: var(--color-text);
}
@ -386,7 +443,11 @@
}
.qq-panel-head {
padding: 11px 16px;
display: flex;
align-items: center;
box-sizing: border-box;
min-height: var(--qq-row, 34px);
padding: 0 16px;
font-size: 13px;
font-weight: 600;
color: var(--color-text);

View File

@ -12,13 +12,19 @@
<div class="qq-dash-grid">
<aside class="qq-dash-side">
<nav class="qq-dash-nav" aria-label="快捷导航">
<a class="item active" href="{{AppSubUrl}}/">{{svg "octicon-home" 16}} 首页</a>
<a class="item" href="{{.ContextUser.DashboardLink}}">{{svg "octicon-pulse" 16}} 动态</a>
<a class="item" href="{{AppSubUrl}}/pulls">{{svg "octicon-git-pull-request" 16}} 合并请求</a>
<a class="item" href="{{AppSubUrl}}/issues">{{svg "octicon-issue-opened" 16}} 议题</a>
<a class="item" href="{{AppSubUrl}}/repo/create">{{svg "octicon-plus" 16}} 新建仓库</a>
</nav>
<details class="qq-quicknav">
<summary>
<span class="qq-quicknav-t">快捷导航</span>
{{svg "octicon-chevron-down" 14 "qq-quicknav-chev"}}
</summary>
<nav class="qq-dash-nav" aria-label="快捷导航">
<a class="item active" href="{{AppSubUrl}}/">{{svg "octicon-home" 16}} 首页</a>
<a class="item" href="{{.ContextUser.DashboardLink}}">{{svg "octicon-pulse" 16}} 动态</a>
<a class="item" href="{{AppSubUrl}}/pulls">{{svg "octicon-git-pull-request" 16}} 合并请求</a>
<a class="item" href="{{AppSubUrl}}/issues">{{svg "octicon-issue-opened" 16}} 议题</a>
<a class="item" href="{{AppSubUrl}}/repo/create">{{svg "octicon-plus" 16}} 新建仓库</a>
</nav>
</details>
<div class="qq-dash-repos">
<div class="qq-dash-side-head">

View File

@ -36,13 +36,19 @@
<div class="qq-dash-grid">
<aside class="qq-dash-side">
<nav class="qq-dash-nav" aria-label="快捷导航">
<a class="item active" href="#">⌂ 首页</a>
<a class="item" href="#">◉ 动态</a>
<a class="item" href="#">⑂ 合并请求</a>
<a class="item" href="#">◎ 议题</a>
<a class="item" href="#">+ 新建仓库</a>
</nav>
<details class="qq-quicknav">
<summary>
<span class="qq-quicknav-t">快捷导航</span>
<svg class="qq-quicknav-chev" viewBox="0 0 16 16" width="14" height="14" fill="currentColor" aria-hidden="true"><path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"/></svg>
</summary>
<nav class="qq-dash-nav" aria-label="快捷导航">
<a class="item active" href="#">⌂ 首页</a>
<a class="item" href="#">◉ 动态</a>
<a class="item" href="#">⑂ 合并请求</a>
<a class="item" href="#">◎ 议题</a>
<a class="item" href="#">+ 新建仓库</a>
</nav>
</details>
<div class="qq-dash-repos">
<div class="qq-dash-side-head"><span>我的仓库</span><a href="#" title="新建仓库">+</a></div>
@ -177,6 +183,34 @@
}
}
})();
// 量尺:?probe=1 时把三栏首行的几何打出来,用于排查对齐
(function () {
if (location.search.indexOf('probe=1') < 0) return;
var sels = [
['左栏 快捷导航', '.qq-quicknav'],
['左栏 summary', '.qq-quicknav > summary'],
['中栏 问候', '.qq-dash-hello'],
['中栏 搜索', '.qq-dash-search'],
['右栏 卡片', '.qq-dash-aside .qq-dash-card'],
['右栏 卡片头', '.qq-dash-aside .qq-panel-head'],
['中栏 第一卡', '.qq-dash-main .qq-dash-card'],
['中栏 第一卡头', '.qq-dash-main .qq-panel-head']
];
var out = [];
sels.forEach(function (pair) {
var el = document.querySelector(pair[1]);
if (!el) { out.push(pair[0] + ': (missing)'); return; }
var r = el.getBoundingClientRect();
var cs = getComputedStyle(el);
out.push(pair[0] + ': top=' + r.top.toFixed(1) + ' left=' + r.left.toFixed(1) +
' h=' + r.height.toFixed(1) + ' mt=' + cs.marginTop + ' mb=' + cs.marginBottom);
});
var pre = document.createElement('pre');
pre.id = 'probe';
pre.textContent = out.join('\n');
document.body.appendChild(pre);
})();
</script>
</body>
</html>