fix(design): 按概念图重排面板层级并验证真实组件
This commit is contained in:
@@ -5,22 +5,26 @@ struct ResourceCard<Content: View>: View {
|
||||
let symbol: String
|
||||
let color: Color
|
||||
let value: String
|
||||
var secondaryValue: String? = nil
|
||||
@ViewBuilder var content: () -> Content
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
HStack {
|
||||
Label(title, systemImage: symbol).font(.system(size: 13, weight: .semibold)).foregroundStyle(color)
|
||||
Spacer(minLength: 6)
|
||||
Text(verbatim: value).font(.system(size: 20, weight: .semibold, design: .rounded)).monospacedDigit()
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Label { Text(title).foregroundStyle(.primary) } icon: {
|
||||
Image(systemName: symbol).foregroundStyle(color)
|
||||
}.font(.system(size: 13, weight: .semibold))
|
||||
HStack(alignment: .firstTextBaseline) {
|
||||
Text(verbatim: value).font(.system(size: 27, weight: .semibold, design: .rounded))
|
||||
.foregroundStyle(color).monospacedDigit().lineLimit(1).minimumScaleFactor(0.8)
|
||||
Spacer(minLength: 4)
|
||||
if let secondaryValue { Text(verbatim: secondaryValue).font(.system(size: 15, weight: .semibold)).foregroundStyle(color).lineLimit(1) }
|
||||
}
|
||||
content()
|
||||
Spacer(minLength: 0)
|
||||
}
|
||||
.font(.system(size: 11))
|
||||
.padding(12)
|
||||
.frame(maxWidth: .infinity, minHeight: 250, alignment: .topLeading)
|
||||
.background(Color("PanelCard"), in: .rect(cornerRadius: 14))
|
||||
.overlay(RoundedRectangle(cornerRadius: 14).strokeBorder(.primary.opacity(0.1)))
|
||||
.padding(10)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
||||
.background(Color("PanelCard"), in: .rect(cornerRadius: 10))
|
||||
.overlay(RoundedRectangle(cornerRadius: 10).strokeBorder(.primary.opacity(0.14)))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user