Some checks are pending
Build AppImage / Build AppImage (push) Waiting to run
Build Apple Apps / Build App (iOS) (push) Waiting to run
Build Apple Apps / Build App (iOS Simulator) (push) Waiting to run
Build Apple Apps / Build App (macOS) (push) Waiting to run
Build Docker / Build Docker Image (push) Waiting to run
Build Rust Crate / Build Crate (macOS (Intel)) (push) Waiting to run
Build Rust Crate / Build Crate (macOS) (push) Waiting to run
Build Rust Crate / Build Crate (Linux) (push) Waiting to run
Build Rust Crate / Build Crate (Windows) (push) Waiting to run
39 lines
1.1 KiB
Swift
39 lines
1.1 KiB
Swift
import SwiftUI
|
|
|
|
struct NetworkCarouselView: View {
|
|
var networks: [any Network] = [
|
|
HackClub(id: 1),
|
|
HackClub(id: 2),
|
|
WireGuard(id: 4),
|
|
HackClub(id: 5)
|
|
]
|
|
|
|
var body: some View {
|
|
ScrollView(.horizontal) {
|
|
LazyHStack {
|
|
ForEach(networks, id: \.id) { network in
|
|
NetworkView(network: network)
|
|
.containerRelativeFrame(.horizontal, count: 10, span: 7, spacing: 0, alignment: .center)
|
|
.scrollTransition(.interactive, axis: .horizontal) { content, phase in
|
|
content
|
|
.scaleEffect(1.0 - abs(phase.value) * 0.1)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.scrollTargetLayout()
|
|
.scrollClipDisabled()
|
|
.scrollIndicators(.hidden)
|
|
.defaultScrollAnchor(.center)
|
|
.scrollTargetBehavior(.viewAligned)
|
|
.containerRelativeFrame(.horizontal)
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
struct NetworkCarouselView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
NetworkCarouselView()
|
|
}
|
|
}
|
|
#endif
|