Files
suixinkan_uikit/suixinkan/UI/Home/Views/HomeStoreCardView.swift
汉秋 87696a4774 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>
2026-07-06 17:58:18 +08:00

61 lines
1.9 KiB
Swift

//
// HomeStoreCardView.swift
// suixinkan
//
import SnapKit
import UIKit
///
final class HomeStoreCardView: UIView {
private let nameLabel = UILabel()
private let addressLabel = UILabel()
private let statusLabel = UILabel()
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = AppColor.cardBackground
layer.cornerRadius = AppRadius.md
nameLabel.font = .app(.title)
nameLabel.textColor = AppColor.textPrimary
addressLabel.font = .app(.body)
addressLabel.textColor = AppColor.textSecondary
addressLabel.numberOfLines = 2
statusLabel.font = .app(.captionMedium)
statusLabel.textColor = AppColor.primary
addSubview(nameLabel)
addSubview(addressLabel)
addSubview(statusLabel)
nameLabel.snp.makeConstraints { make in
make.top.leading.equalToSuperview().offset(AppSpacing.screenHorizontalInset)
make.trailing.lessThanOrEqualTo(statusLabel.snp.leading).offset(-AppSpacing.xs)
}
statusLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(AppSpacing.screenHorizontalInset)
make.trailing.equalToSuperview().offset(-AppSpacing.screenHorizontalInset)
}
addressLabel.snp.makeConstraints { make in
make.top.equalTo(nameLabel.snp.bottom).offset(AppSpacing.xs)
make.leading.trailing.equalToSuperview().inset(AppSpacing.screenHorizontalInset)
make.bottom.equalToSuperview().offset(-AppSpacing.screenHorizontalInset)
}
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func apply(store: StoreItem) {
nameLabel.text = store.name
addressLabel.text = store.address
statusLabel.text = store.statusText.isEmpty ? "营业中" : store.statusText
}
}