jel/Jel/Views/Library/Item/ItemHeaderView.swift

57 lines
1.5 KiB
Swift
Raw Normal View History

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 {
2024-01-08 00:20:56 +00:00
var item: BaseItemDto
2023-12-24 04:47:21 +00:00
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) {
ItemIconView(item: item, imageType: "Backdrop", contentMode: .fill)
2023-12-25 01:01:52 +00:00
.setCornerRadius(0)
.mask(overlayGradient)
.background {
ItemIconView(item: item, imageType: "Backdrop", contentMode: .fill)
2023-12-25 01:01:52 +00:00
.setCornerRadius(0)
.blur(radius: 50)
}
}
2023-12-24 04:47:21 +00:00
HStack {
ItemIconView(item: 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
.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
}
}
}
// #Preview {
// ItemHeaderView(item: BaseItemDto())
// }