70 lines
2.3 KiB
Swift
70 lines
2.3 KiB
Swift
//
|
||
// ScenicPromotionSettingsMaterialRowView.swift
|
||
// suixinkan
|
||
//
|
||
// Created by Codex on 2026/7/2.
|
||
//
|
||
|
||
import SwiftUI
|
||
|
||
/// 设置页已上传素材行,支持预览与删除。
|
||
struct ScenicPromotionSettingsMaterialRowView: View {
|
||
let material: ScenicPromotionManagedMaterial
|
||
let onPreview: () -> Void
|
||
let onDelete: () -> Void
|
||
|
||
var body: some View {
|
||
HStack(spacing: 10) {
|
||
Button(action: onPreview) {
|
||
HStack(spacing: 12) {
|
||
ScenicPromotionSettingsMaterialThumbnail(material: material)
|
||
|
||
VStack(alignment: .leading, spacing: 5) {
|
||
Text(material.title)
|
||
.font(.system(size: 15, weight: .bold))
|
||
.foregroundStyle(AppDesign.textPrimary)
|
||
.lineLimit(1)
|
||
Text(material.subtitle)
|
||
.font(.system(size: 12, weight: .medium))
|
||
.foregroundStyle(AppDesign.textSecondary)
|
||
.lineLimit(1)
|
||
Text(material.createdAt)
|
||
.font(.system(size: 11, weight: .medium))
|
||
.foregroundStyle(Color(hex: 0x8A95A6))
|
||
}
|
||
|
||
Spacer(minLength: 0)
|
||
|
||
Image(systemName: "chevron.right")
|
||
.font(.system(size: 13, weight: .bold))
|
||
.foregroundStyle(Color(hex: 0x9AA5B5))
|
||
}
|
||
}
|
||
.buttonStyle(.plain)
|
||
|
||
Button(action: onDelete) {
|
||
Image(systemName: "trash")
|
||
.font(.system(size: 16, weight: .semibold))
|
||
.foregroundStyle(AppDesign.danger)
|
||
.frame(width: 36, height: 36)
|
||
.background(Color(hex: 0xFFF1F1), in: Circle())
|
||
}
|
||
.buttonStyle(.plain)
|
||
}
|
||
.padding(10)
|
||
.background(Color(hex: 0xF8FAFD), in: RoundedRectangle(cornerRadius: 14))
|
||
}
|
||
}
|
||
|
||
#if DEBUG
|
||
#Preview("素材行") {
|
||
ScenicPromotionSettingsMaterialRowView(
|
||
material: ScenicPromotionPreviewSupport.sampleManagedMaterial,
|
||
onPreview: {},
|
||
onDelete: {}
|
||
)
|
||
.padding()
|
||
.background(AppDesign.background)
|
||
}
|
||
#endif
|