Add close button to open videos view on Mac

This commit is contained in:
Arkadiusz Fal 2022-11-13 14:06:21 +01:00
parent bd08cf02ad
commit 0f8c82bbca

View File

@ -26,12 +26,7 @@ struct OpenVideosView: View {
} }
.toolbar { .toolbar {
ToolbarItem(placement: .navigationBarLeading) { ToolbarItem(placement: .navigationBarLeading) {
Button(action: { presentationMode.wrappedValue.dismiss() }) { closeButton
Label("Close", systemImage: "xmark")
}
#if !os(tvOS)
.keyboardShortcut(.cancelAction)
#endif
} }
} }
.navigationTitle("Open Videos") .navigationTitle("Open Videos")
@ -42,8 +37,24 @@ struct OpenVideosView: View {
#endif #endif
} }
var closeButton: some View {
Button(action: { presentationMode.wrappedValue.dismiss() }) {
Label("Close", systemImage: "xmark")
}
#if os(macOS)
.labelStyle(.titleOnly)
#endif
#if !os(tvOS)
.keyboardShortcut(.cancelAction)
#endif
}
var openVideos: some View { var openVideos: some View {
VStack(alignment: .leading) { VStack(alignment: .leading) {
#if os(macOS)
closeButton
#endif
ZStack(alignment: .topLeading) { ZStack(alignment: .topLeading) {
#if os(tvOS) #if os(tvOS)
TextField("URL to Open", text: $urlsToOpenText) TextField("URL to Open", text: $urlsToOpenText)