Skip to content

Commit 2a388e1

Browse files
- Fixed background issue for custom recents list
1 parent af11097 commit 2a388e1

2 files changed

Lines changed: 26 additions & 20 deletions

File tree

Sources/WelcomeWindow/Views/RecentsListView.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ public struct RecentsListView: View {
5252
RecentsListItem(projectPath: project)
5353
}
5454
.focused($focusedField, equals: .recentProjects)
55-
.listStyle(.sidebar)
56-
.scrollContentBackground(.hidden)
5755
.contextMenu(forSelectionType: URL.self) { items in
5856
if !items.isEmpty {
5957
Button("Show in Finder") {
@@ -83,15 +81,6 @@ public struct RecentsListView: View {
8381
.onDeleteCommand {
8482
removeRecentProjects()
8583
}
86-
.background {
87-
if colorScheme == .dark {
88-
Color(.black).opacity(0.075)
89-
.background(.thickMaterial)
90-
} else {
91-
Color(.white).opacity(0.6)
92-
.background(.regularMaterial)
93-
}
94-
}
9584
.background {
9685
Button("") {
9786
selection.forEach { url in

Sources/WelcomeWindow/Views/WelcomeWindowView.swift

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ import SwiftUI
99
import AppKit
1010

1111
public struct WelcomeWindowView<RecentsView: View, SubtitleView: View>: View {
12+
1213
@Environment(\.dismiss)
1314
private var dismissWindow
1415

16+
@Environment(\.colorScheme)
17+
private var colorScheme
18+
1519
@FocusState private var focusedField: FocusTarget?
1620

1721
@State private var eventMonitor: Any?
@@ -57,15 +61,28 @@ public struct WelcomeWindowView<RecentsView: View, SubtitleView: View>: View {
5761
focusedField: $focusedField
5862
)
5963

60-
if let customList = customRecentsList {
61-
customList(dismiss)
62-
} else {
63-
RecentsListView(
64-
recentProjects: $recentProjects,
65-
selection: $selection,
66-
focusedField: $focusedField,
67-
dismissWindow: dismiss
68-
)
64+
Group {
65+
if let customList = customRecentsList {
66+
customList(dismiss)
67+
} else {
68+
RecentsListView(
69+
recentProjects: $recentProjects,
70+
selection: $selection,
71+
focusedField: $focusedField,
72+
dismissWindow: dismiss
73+
)
74+
}
75+
}
76+
.listStyle(.sidebar)
77+
.scrollContentBackground(.hidden)
78+
.background {
79+
if colorScheme == .dark {
80+
Color(.black).opacity(0.075)
81+
.background(.thickMaterial)
82+
} else {
83+
Color(.white).opacity(0.6)
84+
.background(.regularMaterial)
85+
}
6986
}
7087
}
7188
.clipShape(.rect(cornerRadius: 8))

0 commit comments

Comments
 (0)