Files
hms/apps/miniprogram/src/components/ui/PrimaryButton/index.scss
iven 898e22c715 feat(mp): Phase 1 测试覆盖 + UX 无障碍 — 106 tests PASS + ARIA + focus ring
测试:
- secure-storage: 26 tests (AES 加解密/明文 fallback/迁移/Base64 边界)
- request.ts: 16 tests (扩展 ResponseCache/patientId 隔离/requestUnlimited)
- mock-api: 修复 getCachedPatientId 缺失导致 health 测试失败

UX 无障碍 (10 组件):
- SegmentTabs/DoctorTabBar: role=tablist/tab + aria-selected
- PrimaryButton/SecondaryButton: role=button + aria-disabled/aria-busy
- Loading/LoadingCard: role=status + aria-live=polite
- EmptyState: role=status + aria-live=polite
- ErrorState: role=alert + aria-live=assertive
- TrendChart tooltip: role=tooltip + aria-live=polite
- FormInput: aria-invalid + aria-label

焦点管理:
- 新增 _focus-ring.scss mixin (focus + focus-visible)
- 5 组件 SCSS 应用 focus-ring
2026-05-22 00:24:06 +08:00

57 lines
1.0 KiB
SCSS

@import '../../../styles/variables.scss';
.primary-btn {
display: flex;
align-items: center;
justify-content: center;
gap: var(--tk-gap-xs);
width: 100%;
background: var(--tk-pri);
color: $white;
font-weight: 600;
border: none;
border-radius: 14px;
box-shadow: var(--tk-shadow-btn);
transition: opacity 0.15s, transform 0.15s;
&--default {
height: var(--tk-btn-primary-h);
font-size: var(--tk-font-body-lg);
}
&--large {
height: 54px;
font-size: var(--tk-font-h2);
}
&:active:not(&--disabled):not(&--loading) {
opacity: var(--tk-touch-feedback-opacity);
transform: scale(0.98);
}
@include focus-ring;
&--disabled {
opacity: 0.5;
box-shadow: none;
}
&__spinner {
width: 18px;
height: 18px;
border: 2px solid rgba(255, 255, 255, 0.3);
border-top-color: $white;
border-radius: 50%;
animation: primary-btn-spin 0.6s linear infinite;
}
&__text {
color: $white;
font-weight: 600;
}
}
@keyframes primary-btn-spin {
to { transform: rotate(360deg); }
}