58 lines
1.3 KiB
Swift
58 lines
1.3 KiB
Swift
//
|
|
// MediaRow.swift
|
|
// LuminateUI
|
|
//
|
|
// Created by Brendan Szymanski on 6/5/26.
|
|
//
|
|
|
|
import Adwaita
|
|
import Foundation
|
|
import LuminateCore
|
|
|
|
public struct MediaRow: View {
|
|
|
|
public var title: String
|
|
public var items: [Components.Schemas.BaseItemDto]
|
|
@Binding public var navigation: NavigationStack<Page>
|
|
public var onSeeAll: (() -> Void)?
|
|
|
|
public init(
|
|
title: String,
|
|
items: [Components.Schemas.BaseItemDto],
|
|
navigation: Binding<NavigationStack<Page>>,
|
|
onSeeAll: (() -> Void)? = nil
|
|
) {
|
|
self.title = title
|
|
self.items = items
|
|
_navigation = navigation
|
|
self.onSeeAll = onSeeAll
|
|
}
|
|
|
|
public var view: Body {
|
|
VStack(spacing: 16) {
|
|
HStack {
|
|
Text(title)
|
|
.title3()
|
|
|
|
/// Poor man's `Spacer()`
|
|
Bin()
|
|
.hexpand()
|
|
|
|
if let onSeeAll {
|
|
Button("See All") {
|
|
onSeeAll()
|
|
}
|
|
}
|
|
}
|
|
|
|
ScrollView {
|
|
ForEach(items, horizontal: true) { item in
|
|
HomePosterCell(item: item)
|
|
.padding(16, .trailing)
|
|
}
|
|
}
|
|
.vscrollbarPolicy(.never)
|
|
.hscrollbarPolicy(.external)
|
|
}
|
|
}
|
|
}
|