2023-12-24 04:47:21 +00:00
|
|
|
//
|
|
|
|
// ItemHeaderView.swift
|
|
|
|
// Jel
|
|
|
|
//
|
|
|
|
// Created by zerocool on 12/23/23.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
import JellyfinKit
|
|
|
|
|
|
|
|
struct ItemHeaderView: View {
|
|
|
|
@State var item: BaseItemDto
|
|
|
|
|
|
|
|
let overlayGradient = LinearGradient(gradient: Gradient(stops: [
|
|
|
|
.init(color: .clear, location: 0),
|
2023-12-25 01:01:52 +00:00
|
|
|
.init(color: .black, location: 0.5),
|
|
|
|
// .init(color: .black, location: 0.7),
|
|
|
|
// .init(color: .clear, location: 1)
|
2023-12-24 04:47:21 +00:00
|
|
|
]), startPoint: .bottom, endPoint: .top)
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
ZStack(alignment: .bottom) {
|
2023-12-25 01:01:52 +00:00
|
|
|
StickyHeaderView(minHeight: 300) {
|
|
|
|
LibraryIconView(library: item, imageType: "Backdrop", contentMode: .fill)
|
|
|
|
.hideCaption()
|
|
|
|
.setCornerRadius(0)
|
|
|
|
.mask(overlayGradient)
|
|
|
|
.background {
|
|
|
|
LibraryIconView(library: item, imageType: "Backdrop", contentMode: .fill)
|
|
|
|
.hideCaption()
|
|
|
|
.setCornerRadius(0)
|
|
|
|
.blur(radius: 50)
|
|
|
|
}
|
|
|
|
}
|
2023-12-24 04:47:21 +00:00
|
|
|
|
|
|
|
HStack {
|
2023-12-24 07:36:14 +00:00
|
|
|
LibraryIconView(library: item, imageType: "Logo", width: 200, height: 100, placeHolder: AnyView(Text(item.name ?? "Unknown").font(.title).bold().truncationMode(.middle)))
|
2023-12-24 04:47:21 +00:00
|
|
|
.hideCaption()
|
|
|
|
.setCornerRadius(0)
|
|
|
|
.shadow(radius: 10)
|
2023-12-25 01:01:52 +00:00
|
|
|
.frame(alignment: .leading)
|
2023-12-24 04:47:21 +00:00
|
|
|
Spacer()
|
2023-12-25 01:01:52 +00:00
|
|
|
ItemInfoView(item: item)
|
|
|
|
.foregroundStyle(.white)
|
2023-12-24 04:47:21 +00:00
|
|
|
}
|
2023-12-25 01:01:52 +00:00
|
|
|
.padding([.leading, .trailing])
|
|
|
|
}
|
|
|
|
.scrollTransition {content, phase in
|
|
|
|
content
|
|
|
|
.scaleEffect(phase.isIdentity ? 1 : 2)
|
|
|
|
.opacity(phase.isIdentity ? 1 : 0.1)
|
|
|
|
.blur(radius: phase.isIdentity ? 0 : 50)
|
2023-12-24 04:47:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-24 07:36:14 +00:00
|
|
|
// #Preview {
|
|
|
|
// ItemHeaderView(item: BaseItemDto())
|
|
|
|
// }
|