Skip to content

Commit

Permalink
feat: add open poster in fullscreen in showcard
Browse files Browse the repository at this point in the history
  • Loading branch information
dimensi committed Mar 15, 2024
1 parent ece88f4 commit c9651b6
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions ichime/Show/View/ShowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ struct ShowView: View {

private struct ShowDetails: View {
let show: Show

@State private var showImage = false
@Environment(\.horizontalSizeClass) var horizontalSizeClass

var body: some View {
Expand Down Expand Up @@ -257,6 +257,9 @@ private struct ShowDetails: View {
.frame(width: geometry.size.width, height: geometry.size.height)
.clipped()
.shadow(radius: 8)
.onTapGesture(perform: {
self.showImage = true
})

case .failure:
VStack {
Expand All @@ -269,7 +272,18 @@ private struct ShowDetails: View {
}
)
.frame(width: geometry.size.width, height: geometry.size.height)
}
}.fullScreenCover(isPresented: $showImage, content: {
NavigationStack {
CachedAsyncImage(url: self.show.posterUrl)
.toolbar {
ToolbarItem(placement: .cancellationAction) {
Button("Закрыть") {
showImage = false
}
}
}
}
})

let gridColumns = self.horizontalSizeClass == .compact
? [GridItem(.flexible(), spacing: 18, alignment: .topLeading)]
Expand Down Expand Up @@ -497,5 +511,5 @@ private struct EpisodePreviewList: View {
#Preview {
NavigationStack {
ShowView(showId: 8762)
}.frame(width: 800, height: 400)
}
}

0 comments on commit c9651b6

Please sign in to comment.