Skip to content

Commit 5a1ab45

Browse files
committed
Adjust Nav Filter View Color & Border Width
1 parent 142b718 commit 5a1ab45

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

CodeEdit/Features/NavigatorArea/Views/NavigatorFilterView.swift

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ struct NavigatorFilterView<
2626
let leadingAccessories: LeadingAccessories
2727
let trailingAccessories: TrailingAccessories
2828

29+
/// Indicates that the filter view should have more emphasis, when it's focused or has a value.
30+
private var shouldEmphasize: Bool {
31+
isFocused || !text.isEmpty || hasValue
32+
}
33+
34+
/// The border width to use, changes based on macOS version.
35+
private var strokeWidth: CGFloat {
36+
if #available(macOS 26, *) {
37+
1.0
38+
} else {
39+
1.25
40+
}
41+
}
42+
2943
init(
3044
text: Binding<String>,
3145
hasValue: (() -> Bool)? = nil,
@@ -96,7 +110,7 @@ struct NavigatorFilterView<
96110
)
97111
.overlay(
98112
Capsule()
99-
.stroke(isFocused || !text.isEmpty || hasValue ? .tertiary : .quaternary, lineWidth: 1.25)
113+
.stroke(shouldEmphasize ? .tertiary : .quaternary, lineWidth: strokeWidth)
100114
.clipShape(Capsule())
101115
.disabled(true)
102116
.edgesIgnoringSafeArea(.all)
@@ -112,13 +126,15 @@ struct NavigatorFilterView<
112126
_ isFocused: Bool = false
113127
) -> some View {
114128
if self.controlActive != .inactive || !text.isEmpty || hasValue {
115-
if isFocused || !text.isEmpty || hasValue {
129+
if shouldEmphasize {
116130
Color(.textBackgroundColor)
117131
} else {
118132
if colorScheme == .light {
119133
Color.black.opacity(0.06)
120-
} else {
134+
} else if #unavailable(macOS 26) {
121135
Color.white.opacity(0.24)
136+
} else {
137+
Color.white.opacity(0.09)
122138
}
123139
}
124140
} else {

0 commit comments

Comments
 (0)