mirror of
https://github.com/maxgoedjen/secretive.git
synced 2026-11-15 11:35:59 +01:00
Toolbar style (#606)
This commit is contained in:
1 parent
0e6b218f1f
commit
ed2678a615
2 files changed
+28
-2
No files matched your search
@@ -45,8 +45,14 @@ struct ContentView: View {
|
|||||||
extension ContentView {
|
extension ContentView {
|
||||||
|
|
||||||
|
|
||||||
func toolbarItem(_ view: some View, id: String) -> ToolbarItem<String, some View> {
|
@ToolbarContentBuilder
|
||||||
|
func toolbarItem(_ view: some View, id: String) -> some ToolbarContent {
|
||||||
|
if #available(macOS 26.0, *) {
|
||||||
ToolbarItem(id: id) { view }
|
ToolbarItem(id: id) { view }
|
||||||
|
.sharedBackgroundVisibility(.hidden)
|
||||||
|
} else {
|
||||||
|
ToolbarItem(id: id) { view }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var needsSetup: Bool {
|
var needsSetup: Bool {
|
||||||
|
|||||||
@@ -17,9 +17,28 @@ struct ToolbarButtonStyle: ButtonStyle {
|
|||||||
self.darkColor = darkColor
|
self.darkColor = darkColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@available(macOS 26.0, *)
|
||||||
|
private var glassTint: Color {
|
||||||
|
if !hovering {
|
||||||
|
colorScheme == .light ? lightColor : darkColor
|
||||||
|
} else {
|
||||||
|
colorScheme == .light ? lightColor.exposureAdjust(1) : darkColor.exposureAdjust(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func makeBody(configuration: Configuration) -> some View {
|
func makeBody(configuration: Configuration) -> some View {
|
||||||
configuration.label
|
if #available(macOS 26.0, *) {
|
||||||
|
configuration
|
||||||
|
.label
|
||||||
|
.foregroundColor(.white)
|
||||||
.padding(EdgeInsets(top: 6, leading: 8, bottom: 6, trailing: 8))
|
.padding(EdgeInsets(top: 6, leading: 8, bottom: 6, trailing: 8))
|
||||||
|
.glassEffect(.regular.tint(glassTint), in: .capsule)
|
||||||
|
.onHover { hovering in
|
||||||
|
self.hovering = hovering
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
configuration
|
||||||
|
.label
|
||||||
.background(colorScheme == .light ? lightColor : darkColor)
|
.background(colorScheme == .light ? lightColor : darkColor)
|
||||||
.foregroundColor(.white)
|
.foregroundColor(.white)
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 5))
|
.clipShape(RoundedRectangle(cornerRadius: 5))
|
||||||
@@ -35,3 +54,4 @@ struct ToolbarButtonStyle: ButtonStyle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user