summaryrefslogtreecommitdiff
path: root/DomainDig/DomainDigUI.swift
diff options
context:
space:
mode:
Diffstat (limited to 'DomainDig/DomainDigUI.swift')
-rw-r--r--DomainDig/DomainDigUI.swift56
1 files changed, 41 insertions, 15 deletions
diff --git a/DomainDig/DomainDigUI.swift b/DomainDig/DomainDigUI.swift
index 67c30b4..d0ef40b 100644
--- a/DomainDig/DomainDigUI.swift
+++ b/DomainDig/DomainDigUI.swift
@@ -446,23 +446,26 @@ struct CollapsibleSectionView<HeaderTrailing: View, Content: View>: View {
isCollapsed.toggle()
}
} label: {
- HStack(alignment: .center, spacing: 10) {
- VStack(alignment: .leading, spacing: 3) {
- Text(title)
- .font(appDensity.font(.headline, weight: .semibold))
- .foregroundStyle(.primary)
- if let subtitle {
- Text(subtitle)
- .font(appDensity.font(.caption))
- .foregroundStyle(Color(.appTextSecondary))
+ // One line while the title, trailing controls, and chevron
+ // genuinely fit; otherwise the trailing controls drop below the
+ // title. Without this, a squeezed trailing button letter-wraps
+ // vertically ("N o t e" as a screen-tall capsule) at larger
+ // Dynamic Type sizes — same pathology as the row badges.
+ ViewThatFits(in: .horizontal) {
+ HStack(alignment: .center, spacing: 10) {
+ titleBlock
+ Spacer(minLength: 8)
+ trailing()
+ chevron
+ }
+ VStack(alignment: .leading, spacing: 8) {
+ HStack(alignment: .center, spacing: 10) {
+ titleBlock
+ Spacer(minLength: 8)
+ chevron
}
+ trailing()
}
- Spacer(minLength: 8)
- trailing()
- Image(systemName: isCollapsed ? "chevron.down" : "chevron.up")
- .font(.caption.weight(.semibold))
- .foregroundStyle(Color(.appTextSecondary))
- .accessibilityHidden(true)
}
.contentShape(Rectangle())
.frame(minHeight: appDensity.metrics.controlMinHeight, alignment: .center)
@@ -482,6 +485,29 @@ struct CollapsibleSectionView<HeaderTrailing: View, Content: View>: View {
}
}
}
+
+ private var titleBlock: some View {
+ VStack(alignment: .leading, spacing: 3) {
+ Text(title)
+ .font(appDensity.font(.headline, weight: .semibold))
+ .foregroundStyle(.primary)
+ .fixedSize(horizontal: false, vertical: true)
+ .multilineTextAlignment(.leading)
+ if let subtitle {
+ Text(subtitle)
+ .font(appDensity.font(.caption))
+ .foregroundStyle(Color(.appTextSecondary))
+ .fixedSize(horizontal: false, vertical: true)
+ }
+ }
+ }
+
+ private var chevron: some View {
+ Image(systemName: isCollapsed ? "chevron.down" : "chevron.up")
+ .font(.caption.weight(.semibold))
+ .foregroundStyle(Color(.appTextSecondary))
+ .accessibilityHidden(true)
+ }
}
/// A horizontally scrolling row of read-only tag chips, e.g. for a tracked