From 0f8c82bbca0cb8bb9abf23067977e244f59d0136 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sun, 13 Nov 2022 14:06:21 +0100 Subject: [PATCH] Add close button to open videos view on Mac --- Shared/Views/OpenVideosView.swift | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Shared/Views/OpenVideosView.swift b/Shared/Views/OpenVideosView.swift index 60e76115..53a2f2a1 100644 --- a/Shared/Views/OpenVideosView.swift +++ b/Shared/Views/OpenVideosView.swift @@ -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)