jel/Jel/Views/Item/ItemHeaderView.swift

53 lines
1.5 KiB
Swift

//
// ItemHeaderView.swift
// Jel
//
// Created by zerocool on 12/23/23.
//
import SwiftUI
import JellyfinKit
struct ItemHeaderView: View {
var item: BaseItemDto
let overlayGradientMask = LinearGradient(gradient: Gradient(stops: [
.init(color: .clear, location: 0),
.init(color: .black, location: 0.3),
]), startPoint: .bottom, endPoint: .top)
let overlayGradient = LinearGradient(gradient: Gradient(stops: [
.init(color: .black, location: 0),
.init(color: .clear, location: 0.5)
]), startPoint: .bottom, endPoint: .top)
var body: some View {
ZStack(alignment: .bottom) {
StickyHeaderView(minHeight: 400) {
ItemIconView(item: item, imageType: "Backdrop", contentMode: .fill)
.setCornerRadius(0)
.overlay(overlayGradient)
}
HStack {
ItemIconView(item: item, imageType: "Logo", width: 200, height: 100, placeHolder: AnyView(Text(item.name ?? "Unknown").font(.title).bold().truncationMode(.middle)))
.setCornerRadius(0)
.shadow(radius: 10)
.frame(alignment: .leading)
Spacer()
ItemInfoView(item: item)
}
.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)
// }
}
}
// #Preview {
// ItemHeaderView(item: BaseItemDto())
// }