Introduce unified design tokens and migrate Home, Orders, and Statistics UI.
Establish AppColor/AppFont/AppSpacing/AppRadius theming, shared components, and design-system docs so pilot screens align with Android while keeping iOS-native spacing and touch targets. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -6,20 +6,17 @@
|
||||
import SnapKit
|
||||
import UIKit
|
||||
|
||||
/// 订单状态标签。
|
||||
/// 订单状态标签,内部委托 `AppStatusBadge`。
|
||||
final class OrderStatusBadgeView: UIView {
|
||||
private let label = UILabel()
|
||||
|
||||
private let badge = AppStatusBadge()
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
label.font = .systemFont(ofSize: 14, weight: .medium)
|
||||
label.textAlignment = .center
|
||||
addSubview(label)
|
||||
label.snp.makeConstraints { make in
|
||||
make.edges.equalToSuperview().inset(UIEdgeInsets(top: 2, left: 4, bottom: 2, right: 4))
|
||||
addSubview(badge)
|
||||
badge.snp.makeConstraints { make in
|
||||
make.edges.equalToSuperview()
|
||||
}
|
||||
layer.cornerRadius = 4
|
||||
clipsToBounds = true
|
||||
}
|
||||
|
||||
@available(*, unavailable)
|
||||
@ -28,20 +25,6 @@ final class OrderStatusBadgeView: UIView {
|
||||
}
|
||||
|
||||
func apply(status: Int, text: String) {
|
||||
label.text = text
|
||||
switch status {
|
||||
case 18, 20:
|
||||
label.textColor = UIColor(hex: 0x0073FF)
|
||||
backgroundColor = UIColor(hex: 0xEFF6FF)
|
||||
case 30:
|
||||
label.textColor = UIColor(hex: 0x10B981)
|
||||
backgroundColor = UIColor(hex: 0xF0FDF4)
|
||||
case 50:
|
||||
label.textColor = UIColor(hex: 0xEF4444)
|
||||
backgroundColor = UIColor(hex: 0xFFE7E7)
|
||||
default:
|
||||
label.textColor = UIColor(hex: 0xFF7B00)
|
||||
backgroundColor = UIColor(hex: 0xFFF0E2)
|
||||
}
|
||||
badge.applyOrderStatus(status, text: text)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user