Skip to content

Commit 7a33936

Browse files
committed
feat: adapt compact transient feedback surfaces
1 parent 9239171 commit 7a33936

2 files changed

Lines changed: 75 additions & 45 deletions

File tree

‎EdgeMark/UI/Components/ClipboardFeedbackView.swift‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,25 @@ struct ClipboardFeedbackView: View {
1010
}
1111

1212
var body: some View {
13+
if #available(macOS 26.0, *) {
14+
feedbackLabel
15+
.glassEffect(.regular, in: Capsule())
16+
} else {
17+
feedbackLabel
18+
.background(.regularMaterial, in: Capsule())
19+
.overlay {
20+
Capsule()
21+
.strokeBorder(.separator.opacity(0.5), lineWidth: 0.5)
22+
}
23+
.shadow(color: .black.opacity(0.15), radius: 8, y: 3)
24+
}
25+
}
26+
27+
private var feedbackLabel: some View {
1328
Label(message, systemImage: "checkmark.circle.fill")
1429
.font(.callout.weight(.medium))
1530
.padding(.horizontal, 12)
1631
.padding(.vertical, 8)
17-
.background(.regularMaterial, in: Capsule())
18-
.overlay {
19-
Capsule()
20-
.strokeBorder(.separator.opacity(0.5), lineWidth: 0.5)
21-
}
22-
.shadow(color: .black.opacity(0.15), radius: 8, y: 3)
2332
.accessibilityLabel(message)
2433
}
2534
}

‎EdgeMark/UI/Components/FindBarView.swift‎

Lines changed: 60 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -71,52 +71,35 @@ struct FindBarView: View {
7171

7272
Divider().frame(height: 14)
7373

74-
// Previous match
75-
Button { navigateBackward() } label: {
76-
Image(systemName: "chevron.up")
77-
.imageScale(.small)
78-
}
79-
.buttonStyle(.plain)
80-
.disabled(matches.isEmpty)
81-
.help("Previous match (⇧↩)")
82-
83-
// Next match
84-
Button { navigateForward() } label: {
85-
Image(systemName: "chevron.down")
86-
.imageScale(.small)
74+
GlassControlGroup {
75+
HStack(spacing: 0) {
76+
AdaptiveIconButton(
77+
systemName: "chevron.up",
78+
help: "Previous match (⇧↩)",
79+
action: navigateBackward,
80+
)
81+
.disabled(matches.isEmpty)
82+
83+
AdaptiveIconButton(
84+
systemName: "chevron.down",
85+
help: "Next match (↩)",
86+
action: navigateForward,
87+
)
88+
.disabled(matches.isEmpty)
89+
}
8790
}
88-
.buttonStyle(.plain)
89-
.disabled(matches.isEmpty)
90-
.help("Next match (↩)")
9191

9292
Divider().frame(height: 14)
9393

94-
// Case-sensitive toggle
95-
Button {
96-
caseSensitive.toggle()
97-
} label: {
98-
Text("Aa")
99-
.font(.system(size: 11, weight: caseSensitive ? .bold : .regular))
100-
.foregroundStyle(caseSensitive ? .primary : .secondary)
101-
.frame(width: 22, height: 18)
102-
.background(
103-
caseSensitive
104-
? AnyView(RoundedRectangle(cornerRadius: 4).fill(.quaternary))
105-
: AnyView(EmptyView()),
106-
)
107-
}
108-
.buttonStyle(.plain)
109-
.help(l10n["find.caseSensitive"])
94+
caseSensitivityButton
11095

11196
Divider().frame(height: 14)
11297

113-
// Close button
114-
Button { dismiss() } label: {
115-
Image(systemName: "xmark")
116-
.imageScale(.small)
117-
}
118-
.buttonStyle(.plain)
119-
.help(l10n["find.close"])
98+
AdaptiveIconButton(
99+
systemName: "xmark",
100+
help: l10n["find.close"],
101+
action: dismiss,
102+
)
120103
}
121104

122105
// Row 2: replace field + buttons
@@ -166,6 +149,44 @@ struct FindBarView: View {
166149
}
167150
}
168151

152+
@ViewBuilder
153+
private var caseSensitivityButton: some View {
154+
if #available(macOS 26.0, *) {
155+
Button {
156+
caseSensitive.toggle()
157+
} label: {
158+
caseSensitivityLabel
159+
}
160+
.buttonStyle(.glass)
161+
.help(l10n["find.caseSensitive"])
162+
.accessibilityLabel(l10n["find.caseSensitive"])
163+
} else {
164+
Button {
165+
caseSensitive.toggle()
166+
} label: {
167+
caseSensitivityLabel
168+
.background {
169+
RoundedRectangle(cornerRadius: SurfaceMetrics.compactControlCornerRadius)
170+
.fill(Color.primary.opacity(caseSensitive ? 0.12 : 0))
171+
}
172+
}
173+
.buttonStyle(.plain)
174+
.help(l10n["find.caseSensitive"])
175+
.accessibilityLabel(l10n["find.caseSensitive"])
176+
}
177+
}
178+
179+
private var caseSensitivityLabel: some View {
180+
Text("Aa")
181+
.font(.system(size: 11, weight: caseSensitive ? .bold : .regular))
182+
.foregroundStyle(caseSensitive ? Color.accentColor : .secondary)
183+
.frame(
184+
width: SurfaceMetrics.compactControlSize,
185+
height: SurfaceMetrics.compactControlSize,
186+
)
187+
.contentShape(Rectangle())
188+
}
189+
169190
// MARK: - Match engine
170191

171192
private static func findMatches(

0 commit comments

Comments
 (0)