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 {
ToolbarItem(placement: .navigationBarLeading) {
Button(action: { presentationMode.wrappedValue.dismiss() }) {
Label("Close", systemImage: "xmark")
}
#if !os(tvOS)
.keyboardShortcut(.cancelAction)
#endif
closeButton
}
}
.navigationTitle("Open Videos")
@ -42,8 +37,24 @@ struct OpenVideosView: View {
#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 {
VStack(alignment: .leading) {
#if os(macOS)
closeButton
#endif
ZStack(alignment: .topLeading) {
#if os(tvOS)
TextField("URL to Open", text: $urlsToOpenText)