Skip to content

Commit 9db1161

Browse files
committed
Use conditional modifier
1 parent 5de478e commit 9db1161

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

Lingua-App/Lingua/Lingua/Scenes/ProjectFormView/ProjectFormView.swift

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,16 @@ struct ProjectFormView: View {
5454
}
5555
.padding()
5656
.overlay {
57-
if copied {
58-
Text(Lingua.ProjectForm.copiedToClipboard)
59-
.padding(8)
60-
.background(
61-
Color.black
62-
.opacity(0.4)
63-
)
64-
.clipShape(RoundedRectangle(cornerRadius: 6))
65-
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
66-
.padding(.top, 6)
67-
}
57+
Text(Lingua.ProjectForm.copiedToClipboard)
58+
.padding(8)
59+
.background(
60+
Color.black
61+
.opacity(0.4)
62+
)
63+
.clipShape(RoundedRectangle(cornerRadius: 6))
64+
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
65+
.padding(.top, 6)
66+
.shouldAddView(copied)
6867
}
6968
}
7069
}

Lingua-App/Lingua/Lingua/Utils/Components/UI/DirectoryInputField.swift

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,16 @@ struct DirectoryInputField: View {
4040
.padding(.vertical, 5)
4141
.background(
4242
GeometryReader { geometry in
43-
if isHovered {
44-
Text(directoryPath)
45-
.font(.caption)
46-
.padding(8)
47-
.background(Color.black.opacity(0.8))
48-
.foregroundColor(.white)
49-
.cornerRadius(8)
50-
.frame(width: geometry.size.width, alignment: .center)
51-
.offset(y: -geometry.size.height)
52-
.transition(.opacity)
53-
}
43+
Text(directoryPath)
44+
.font(.caption)
45+
.padding(8)
46+
.background(Color.black.opacity(0.8))
47+
.foregroundColor(.white)
48+
.cornerRadius(8)
49+
.frame(width: geometry.size.width, alignment: .center)
50+
.offset(y: -geometry.size.height)
51+
.transition(.opacity)
52+
.shouldAddView(isHovered)
5453
}
5554
)
5655
}

0 commit comments

Comments
 (0)