Skip to content

Commit

Permalink
Make the CloseButton always visible
Browse files Browse the repository at this point in the history
  • Loading branch information
mallexxx committed Oct 30, 2024
1 parent a047703 commit aa6f132
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ extension HomePage.Views {
let customBackground: CustomBackground?
@ViewBuilder let content: () -> Content

@State var isHovering = false
@EnvironmentObject var model: HomePage.Models.SettingsModel

init(
Expand Down Expand Up @@ -114,17 +113,13 @@ extension HomePage.Views {
model.customImagesManager?.deleteImage(image)
}
.colorScheme(image.colorScheme)
.visibility(isHovering ? .visible : .gone)
Spacer()
}
}
.padding([.top, .trailing], 4)
}
}
.contentShape(Rectangle())
.onHover { isHovering in
self.isHovering = isHovering
}
}

@ViewBuilder
Expand Down
8 changes: 3 additions & 5 deletions DuckDuckGo/HomePage/View/PromotionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ extension HomePage.Views {

var viewModel: PromotionViewModel

@State var isHovering = false
@EnvironmentObject var settingsModel: HomePage.Models.SettingsModel

var body: some View {
Expand Down Expand Up @@ -64,16 +63,12 @@ extension HomePage.Views {
}
}
.padding(.horizontal, 2)
.onHover { isHovering in
self.isHovering = isHovering
}
}

private var closeButton: some View {
HomePage.Views.CloseButton(icon: .close, size: 16) {
viewModel.closeAction()
}
.visibility(isHovering ? .visible : .invisible)
.padding(6)
}

Expand Down Expand Up @@ -102,4 +97,7 @@ extension HomePage.Views {

#Preview {
return HomePage.Views.PromotionView(viewModel: PromotionViewModel.freemiumDBPPromotion(proceedAction: {}, closeAction: {}))
.frame(height: 85)
.environmentObject(HomePage.Models.SettingsModel())

}
5 changes: 0 additions & 5 deletions DuckDuckGo/HomePage/View/RemoteMessageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ struct RemoteMessageView: View {

let viewModel: RemoteMessageViewModel

@State var isHovering = false
@EnvironmentObject var settingsModel: HomePage.Models.SettingsModel

var body: some View {
Expand Down Expand Up @@ -77,9 +76,6 @@ struct RemoteMessageView: View {
}
}
.padding(.horizontal, 2)
.onHover { isHovering in
self.isHovering = isHovering
}
.onAppear(perform: viewModel.onDidAppear)
.onDisappear(perform: viewModel.onDidDisappear)
}
Expand All @@ -90,7 +86,6 @@ struct RemoteMessageView: View {
await viewModel.onDidClose(.close)
}
}
.visibility(isHovering ? .visible : .invisible)
.padding(6)
}

Expand Down
1 change: 0 additions & 1 deletion DuckDuckGo/Sync/Promotion/SyncPromoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ struct SyncPromoView: View {
HomePage.Views.CloseButton(icon: .close, size: 16) {
dismissAction()
}
.visibility(isHovering ? .visible : .invisible)
.padding(6)

Spacer()
Expand Down

0 comments on commit aa6f132

Please sign in to comment.