style(admin): align list typography with orders

This commit is contained in:
2026-08-31 15:36:02 +08:00
parent cd290b8dc6
commit afbee83b51
7 changed files with 111 additions and 13 deletions
+55
View File
@@ -0,0 +1,55 @@
import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { describe, expect, it } from 'vitest'
function source(path: string) {
return readFileSync(resolve(process.cwd(), path), 'utf8')
}
describe('Admin list typography baseline', () => {
it('freezes the UnifiedOrdersView desktop hierarchy as shared tokens', () => {
const foundation = source('src/styles/foundation.css')
for (const token of [
'--cc-list-page-title-font-size: 20px',
'--cc-list-page-description-font-size: 12px',
'--cc-list-query-font-size: 14px',
'--cc-list-table-font-size: 12px',
'--cc-list-primary-font-size: 12px',
'--cc-list-secondary-font-size: 12px',
'--cc-list-status-font-size: 11px',
'--cc-list-action-font-size: 12px',
'--cc-list-pagination-font-size: 12px',
'--cc-list-page-button-font-size: 14px',
]) expect(foundation).toContain(token)
})
it('applies the tokens through shared page, query, table, status, action, empty, and pagination styles', () => {
const shell = source('src/styles/shell.css')
const global = source('src/styles/index.css')
const table = source('src/shared/components/DataTable.vue')
const query = source('src/shared/components/QueryToolbar.vue')
expect(shell).toContain('font-size: var(--cc-list-page-title-font-size)')
expect(shell).toContain('font-size: var(--cc-list-page-description-font-size)')
expect(query).toContain('font-size: var(--cc-list-query-font-size)')
expect(table).toContain('.data-table :deep(.el-table) { font-size: var(--cc-list-table-font-size); }')
expect(table).toContain('.data-table :deep(.el-table .el-button) { font-size: var(--cc-list-action-font-size); }')
expect(table).toContain('.data-table :deep(.el-table__empty-text) { font-size: var(--cc-list-table-font-size); }')
expect(table).toContain('font-size: var(--cc-list-pagination-font-size)')
expect(global).toContain('font-size: var(--cc-list-primary-font-size)')
expect(global).toContain('font-size: var(--cc-list-secondary-font-size)')
expect(global).toContain('font-size: var(--cc-list-status-font-size)')
})
it.each([
'src/modules/ocean-bookings/pages/OceanBookingsView.vue',
'src/modules/trucking/pages/TruckAppointmentsView.vue',
'src/modules/customs/pages/CustomsCasesView.vue',
'src/modules/outbound-dispatch/pages/OutboundDispatchesView.vue',
'src/modules/port-schedules/pages/PortSchedulesView.vue',
])('keeps representative formal list %s on the shared components', (path) => {
const page = source(path)
expect(page).toContain('<ListPageLayout')
expect(page).toContain('<QueryToolbar')
expect(page).toContain('<DataTable')
})
})
+12
View File
@@ -42,6 +42,18 @@
--cc-space-5: 20px;
--cc-space-6: 24px;
--cc-space-7: 32px;
/* Admin list typography: frozen from UnifiedOrdersView at 1920×1080 / 100%. */
--cc-list-page-title-font-size: 20px;
--cc-list-page-description-font-size: 12px;
--cc-list-query-font-size: 14px;
--cc-list-table-font-size: 12px;
--cc-list-table-header-font-weight: 600;
--cc-list-primary-font-size: 12px;
--cc-list-secondary-font-size: 12px;
--cc-list-status-font-size: 11px;
--cc-list-action-font-size: 12px;
--cc-list-pagination-font-size: 12px;
--cc-list-page-button-font-size: 14px;
--el-color-primary: var(--cc-primary);
--el-color-primary-light-3: #84adff;
+7 -5
View File
@@ -86,18 +86,20 @@
.panel-heading h2 { margin: 0; font-size: 16px; }
.panel-heading p { margin: 5px 0 0; color: var(--cc-muted); font-size: 12px; line-height: 1.5; }
.table-panel .el-table { --el-table-border-color: #edf0f4; --el-table-header-bg-color: #f8fafc; --el-table-row-hover-bg-color: #f8fbff; }
.table-panel .el-table th.el-table__cell { height: 44px; color: #475467; font-size: 12px; font-weight: 650; }
.table-panel .el-table { font-size: var(--cc-list-table-font-size); }
.table-panel .el-table th.el-table__cell { height: 44px; color: #475467; font-size: var(--cc-list-table-font-size); font-weight: var(--cc-list-table-header-font-weight); }
.table-panel .el-table td.el-table__cell { padding: 12px 0; }
.primary-cell, .user-cell { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.primary-cell strong, .user-cell strong { overflow: hidden; color: #172033; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.primary-cell span, .user-cell span { overflow: hidden; color: var(--cc-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.primary-cell strong, .user-cell strong { overflow: hidden; color: #172033; font-size: var(--cc-list-primary-font-size); text-overflow: ellipsis; white-space: nowrap; }
.primary-cell span, .user-cell span { overflow: hidden; color: var(--cc-muted); font-size: var(--cc-list-secondary-font-size); text-overflow: ellipsis; white-space: nowrap; }
.user-cell { flex-direction: row; align-items: center; gap: 10px; }
.user-cell > span:first-child, .detail-identity > span { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #eaf1ff; color: var(--cc-primary); font-weight: 700; }
.user-cell > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.table-actions { display: flex; align-items: center; white-space: nowrap; }
.table-actions .el-button { font-size: var(--cc-list-action-font-size); }
.table-actions .el-button + .el-button { margin-left: 10px; }
.table-footer { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--cc-border); color: var(--cc-muted); font-size: 12px; }
.status-badge { display: inline-flex; min-height: 24px; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; background: #f2f4f7; color: #475467; font-size: 11px; font-weight: 650; white-space: nowrap; }
.table-footer { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--cc-border); color: var(--cc-muted); font-size: var(--cc-list-pagination-font-size); }
.status-badge { display: inline-flex; min-height: 24px; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; background: #f2f4f7; color: #475467; font-size: var(--cc-list-status-font-size); font-weight: 650; white-space: nowrap; }
.status-badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge.is-success { background: #ecfdf3; color: #067647; }
.status-badge.is-warning { background: #fffaeb; color: #b54708; }
+2 -2
View File
@@ -52,8 +52,8 @@
.shell-menu-button:hover { background: rgba(255,255,255,.12); }
.shell-menu-button:focus-visible { outline-color: rgba(255,255,255,.8); }
.page-heading { min-width: 0; flex: 1; }
.page-heading h1 { margin: 0; overflow: hidden; font-size: 20px; letter-spacing: 0; text-overflow: ellipsis; white-space: nowrap; }
.page-heading p { margin: 4px 0 0; overflow: hidden; color: rgba(255,255,255,.72); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.page-heading h1 { margin: 0; overflow: hidden; font-size: var(--cc-list-page-title-font-size); letter-spacing: 0; text-overflow: ellipsis; white-space: nowrap; }
.page-heading p { margin: 4px 0 0; overflow: hidden; color: rgba(255,255,255,.72); font-size: var(--cc-list-page-description-font-size); text-overflow: ellipsis; white-space: nowrap; }
.header-user { display: flex; min-width: 0; flex: 0 0 auto; align-items: center; gap: 10px; }
.user-avatar { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: #fff; color: var(--cc-primary); font-weight: 700; box-shadow: var(--cc-shadow-sm); }
.user-copy { display: flex; flex-direction: column; }