Skip to content

Commit c4a2d44

Browse files
committed
feat: add adaptive popup action hovers
1 parent e77fa67 commit c4a2d44

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

‎EdgeMark/UI/Components/HeaderActionMenu.swift‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ struct HeaderActionMenu<MenuContent: View>: View {
9393

9494
/// A full-width action row used inside `HeaderActionMenu` popovers.
9595
struct HeaderActionButton: View {
96+
@Environment(AppSettings.self) private var appSettings
97+
9698
let title: String
9799
let systemName: String
98100
var role: ButtonRole?
@@ -118,8 +120,7 @@ struct HeaderActionButton: View {
118120
.frame(maxWidth: .infinity, minHeight: 30, alignment: .leading)
119121
.contentShape(Rectangle())
120122
.background {
121-
RoundedRectangle(cornerRadius: 6, style: .continuous)
122-
.fill(.primary.opacity(isHovered ? 0.1 : 0))
123+
hoverBackground
123124
}
124125
}
125126
.buttonStyle(.plain)
@@ -136,4 +137,25 @@ struct HeaderActionButton: View {
136137
}
137138
return isHovered ? .primary : .secondary
138139
}
140+
141+
@ViewBuilder
142+
private var hoverBackground: some View {
143+
if #available(macOS 26.0, *), appSettings.usesLiquidGlass, isHovered {
144+
let shape = RoundedRectangle(
145+
cornerRadius: SurfaceMetrics.liquidGlassControlCornerRadius,
146+
style: .continuous,
147+
)
148+
shape
149+
.fill(.primary.opacity(0.12))
150+
.overlay {
151+
shape.stroke(.primary.opacity(0.08), lineWidth: 0.5)
152+
}
153+
} else {
154+
RoundedRectangle(
155+
cornerRadius: SurfaceMetrics.classicControlCornerRadius,
156+
style: .continuous,
157+
)
158+
.fill(.primary.opacity(isHovered ? 0.1 : 0))
159+
}
160+
}
139161
}

0 commit comments

Comments
 (0)