Adjusts the monster detail view so it makes better use of small screens.
This commit is contained in:
@@ -8,6 +8,8 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct LabeledField<Content: View>: View {
|
struct LabeledField<Content: View>: View {
|
||||||
|
@Environment(\.horizontalSizeClass) var sizeClass
|
||||||
|
|
||||||
let content: Content
|
let content: Content
|
||||||
let label: String
|
let label: String
|
||||||
|
|
||||||
@@ -19,10 +21,18 @@ struct LabeledField<Content: View>: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
HStack(alignment: .top) {
|
if (sizeClass == .compact) {
|
||||||
Text(label)
|
VStack(alignment: .leading) {
|
||||||
.fontWeight(.bold)
|
Text(label)
|
||||||
content
|
.fontWeight(.bold)
|
||||||
|
content
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
HStack(alignment: .top) {
|
||||||
|
Text(label)
|
||||||
|
.fontWeight(.bold)
|
||||||
|
content
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user