chore(admin-ui): tokenise governance blocks and warn hints

This commit is contained in:
萝卜
2026-03-16 00:45:35 +08:00
parent aeee25e78c
commit f73f2dddac
3 changed files with 55 additions and 9 deletions

View File

@@ -71,8 +71,8 @@
/* 平台订单:退款状态治理区块 */
.refund-governance-block{
margin-top:12px;
border:1px dashed #fda29b;
background:#fff1f3;
border:1px dashed var(--adm-error-border-strong, rgba(239, 68, 68, .45));
background:var(--adm-error-bg, #fef2f2);
}
.refund-governance-title{
@@ -87,8 +87,8 @@
.governance-block{
margin-top:10px;
width:100%;
border:1px solid #f5c2c7;
background:#fff5f5;
border:1px solid var(--adm-error-border-soft, rgba(239, 68, 68, .25));
background:var(--adm-error-bg, #fef2f2);
}
.governance-block-title{
@@ -295,13 +295,13 @@
.platform-orders-table .row-warn{
margin-top:4px;
padding:4px 6px;
border-left:3px solid #e06b67;
background:#fff9f9;
border-left:3px solid var(--adm-error, #ef4444);
background:var(--adm-error-bg, #fef2f2);
border-radius:4px;
}
.platform-orders-table .row-warn a.link{
color:#b52b27;
color:var(--adm-error, #ef4444);
text-decoration:underline;
}
@@ -314,8 +314,8 @@
display:inline-block;
padding:1px 6px;
border-radius:10px;
background:#ffecec;
color:#b52b27;
background:var(--adm-error-tint, rgba(239, 68, 68, .12));
color:var(--adm-error, #ef4444);
margin-right:4px;
}

View File

@@ -48,4 +48,10 @@
--adm-success-bg: #f0fdf4;
--adm-warning-bg: #fffbeb;
--adm-error-bg: #fef2f2;
/* 状态色衍生(用于治理提示块/弱提示/标签等) */
--adm-error-border-soft: rgba(239, 68, 68, .25);
--adm-error-border-strong: rgba(239, 68, 68, .45);
--adm-error-tint: rgba(239, 68, 68, .12);
--adm-error-tint-strong: rgba(239, 68, 68, .18);
}

View File

@@ -0,0 +1,40 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminComponentsCssGovernanceBlocksShouldUseThemeTokensTest extends TestCase
{
use RefreshDatabase;
protected function loginAsPlatformAdmin(): void
{
$this->seed();
$this->post('/admin/login', [
'email' => 'platform.admin@demo.local',
'password' => 'Platform@123456',
])->assertRedirect('/admin');
}
public function test_admin_components_css_governance_blocks_should_use_theme_tokens(): void
{
$this->loginAsPlatformAdmin();
$css = file_get_contents(public_path('css/admin-components.css'));
$this->assertIsString($css);
// 治理提示块必须用主题 token避免硬编码色值导致整体风格难以统一。
$this->assertStringContainsString('.governance-block{', $css);
$this->assertStringContainsString('border:1px solid var(--adm-error-border-soft', $css);
$this->assertStringContainsString('background:var(--adm-error-bg', $css);
// 列表行内治理提示row-warn也必须用 token。
$this->assertStringContainsString('.platform-orders-table .row-warn{', $css);
$this->assertStringContainsString('border-left:3px solid var(--adm-error', $css);
$this->assertStringContainsString('.platform-orders-table .row-warn-prefix{', $css);
$this->assertStringContainsString('background:var(--adm-error-tint', $css);
}
}