From 6ded62df9247ff17813ee595580000d61fd38a9d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Oct 2026 22:10:45 +0800 Subject: [PATCH] fix(user-center): 1:1 port reference sidebar service/settings icon boxes Co-Authored-By: Claude Fable 5 --- assets/css/routes/user-center/shell.css | 35 +++++++++++++++---- .../user-center-renderers/sidebar-nav.php | 11 +++--- ...ser-center-sidebar-icons-contract.test.cjs | 13 ++++++- 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/assets/css/routes/user-center/shell.css b/assets/css/routes/user-center/shell.css index 196f9fd1..9445d840 100644 --- a/assets/css/routes/user-center/shell.css +++ b/assets/css/routes/user-center/shell.css @@ -605,21 +605,44 @@ body.aksrt-user-center .uc-content, .uc-summary-card--wallet .uc-summary-card__body { color: #3978d6; } .uc-summary-card--points .uc-summary-card__body { color: #ba7a0a; } -/* Services / settings grids, ported from the reference theme sidebar: - four per row, no tinted tile behind the icon. */ +/* 我的服务 / 功能设置:1:1 参考主题 zib_user_center_page_sidebar_button_1/2()。 + 外壳为 zib-widget padding-6,标题为普通字重的 padding-6 ml3; + 网格项只继承正文色,参考主题没有 hover / 选中变色。 */ +.uc-sidebar-iconbox.zib-widget { + clear: both; + background-color: var(--main-bg-color); + box-shadow: 0 0 10px var(--main-shadow); + border-radius: var(--main-radius); + margin-bottom: 8px; + color: var(--main-color); +} + .user-icon-but-box > a { width: calc(25% - 10px); margin: 5px; min-width: 50px; max-width: 100px; - color: var(--color-ink-3); - text-align: center; + cursor: pointer; + color: inherit; text-decoration: none; } .user-icon-but-box > a:hover, -.user-icon-but-box > a.is-active { - color: var(--color-primary); +.user-icon-but-box > a:focus { + color: inherit; +} + +@media (max-width: 767px) { + .uc-sidebar-iconbox.zib-widget { + margin-bottom: 0; + } +} + +@media (max-width: 991.98px) { + .uc-sidebar > .uc-sidebar-iconbox { + margin-right: 12px; + margin-left: 12px; + } } .uc-follow-management__list { display: grid; gap: 10px; margin-top: 16px; } diff --git a/inc/helpers/user-center-renderers/sidebar-nav.php b/inc/helpers/user-center-renderers/sidebar-nav.php index c47fe251..40180ccd 100644 --- a/inc/helpers/user-center-renderers/sidebar-nav.php +++ b/inc/helpers/user-center-renderers/sidebar-nav.php @@ -74,9 +74,6 @@ $render_grid = static function (array $items): void { data-tab=""> @@ -89,15 +86,15 @@ $render_grid = static function (array $items): void { }; ?> -
-
+
+
-
-
+
+
diff --git a/tests/widget-system/user-center-sidebar-icons-contract.test.cjs b/tests/widget-system/user-center-sidebar-icons-contract.test.cjs index 6ce496d2..73ac2145 100644 --- a/tests/widget-system/user-center-sidebar-icons-contract.test.cjs +++ b/tests/widget-system/user-center-sidebar-icons-contract.test.cjs @@ -112,7 +112,18 @@ test('旧 uc-service-grid 外壳与色调底色已彻底移除', () => { // 参考主题网格尺寸落地。 assert.match(shell, /\.user-icon-but-box > a \{[^}]*width: calc\(25% - 10px\)/s); assert.match(shell, /\.user-icon-but-box > a \{[^}]*min-width: 50px/s); - assert.match(shell, /\.user-icon-but-box > a\.is-active/); + // 参考主题网格项没有 hover / 选中变色,只继承正文色。 + assert.doesNotMatch(shell, /\.user-icon-but-box > a\.is-active/); + assert.match(shell, /\.user-icon-but-box > a \{[^}]*color: inherit/s); + + // 外壳与标题 1:1 参考主题 zib-widget padding-6 / padding-6 ml3。 + const nav = read(sidebarDir + 'sidebar-nav.php'); + assert.match(nav, /class="uc-sidebar-iconbox zib-widget padding-6 mb10-sm"/); + assert.match(nav, /class="uc-sidebar-iconbox zib-widget padding-6"/); + assert.match(nav, /
<\?php esc_html_e\('我的服务'/); + assert.match(nav, /
<\?php esc_html_e\('功能设置'/); + assert.doesNotMatch(nav, /uc-sidebar__heading/); + assert.match(shell, /\.uc-sidebar-iconbox\.zib-widget \{/); // 卡片上的 已换成 ,元素选择器需覆盖两者。 assert.match(shell, /\.uc-summary-card__body > svg/);