From 9db11614e792cffa0b13ed3db6e58c9fae97d678 Mon Sep 17 00:00:00 2001 From: Yll Fejziu Date: Thu, 21 Nov 2024 09:48:40 +0100 Subject: [PATCH] Use conditional modifier --- .../ProjectFormView/ProjectFormView.swift | 21 +++++++++---------- .../Components/UI/DirectoryInputField.swift | 21 +++++++++---------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/Lingua-App/Lingua/Lingua/Scenes/ProjectFormView/ProjectFormView.swift b/Lingua-App/Lingua/Lingua/Scenes/ProjectFormView/ProjectFormView.swift index 8d65e7b..f63baf3 100644 --- a/Lingua-App/Lingua/Lingua/Scenes/ProjectFormView/ProjectFormView.swift +++ b/Lingua-App/Lingua/Lingua/Scenes/ProjectFormView/ProjectFormView.swift @@ -54,17 +54,16 @@ struct ProjectFormView: View { } .padding() .overlay { - if copied { - Text(Lingua.ProjectForm.copiedToClipboard) - .padding(8) - .background( - Color.black - .opacity(0.4) - ) - .clipShape(RoundedRectangle(cornerRadius: 6)) - .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top) - .padding(.top, 6) - } + Text(Lingua.ProjectForm.copiedToClipboard) + .padding(8) + .background( + Color.black + .opacity(0.4) + ) + .clipShape(RoundedRectangle(cornerRadius: 6)) + .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top) + .padding(.top, 6) + .shouldAddView(copied) } } } diff --git a/Lingua-App/Lingua/Lingua/Utils/Components/UI/DirectoryInputField.swift b/Lingua-App/Lingua/Lingua/Utils/Components/UI/DirectoryInputField.swift index 3b6d0ec..a6d5792 100644 --- a/Lingua-App/Lingua/Lingua/Utils/Components/UI/DirectoryInputField.swift +++ b/Lingua-App/Lingua/Lingua/Utils/Components/UI/DirectoryInputField.swift @@ -40,17 +40,16 @@ struct DirectoryInputField: View { .padding(.vertical, 5) .background( GeometryReader { geometry in - if isHovered { - Text(directoryPath) - .font(.caption) - .padding(8) - .background(Color.black.opacity(0.8)) - .foregroundColor(.white) - .cornerRadius(8) - .frame(width: geometry.size.width, alignment: .center) - .offset(y: -geometry.size.height) - .transition(.opacity) - } + Text(directoryPath) + .font(.caption) + .padding(8) + .background(Color.black.opacity(0.8)) + .foregroundColor(.white) + .cornerRadius(8) + .frame(width: geometry.size.width, alignment: .center) + .offset(y: -geometry.size.height) + .transition(.opacity) + .shouldAddView(isHovered) } ) }