Files
damus/damus/Views/Profile/CondensedProfilePicturesView.swift
T
tyiu 422167f7aa Add indication of followers you know in a profile
Changelog-Added: Add indication of followers you know in a profile
2023-06-25 09:38:57 +02:00

39 lines
1.2 KiB
Swift

//
// CondensedProfilePicturesView.swift
// damus
//
// Created by Terry Yiu on 6/19/23.
//
import SwiftUI
struct CondensedProfilePicturesView: View {
let state: DamusState
let pubkeys: [String]
let maxPictures: Int
init(state: DamusState, pubkeys: [String], maxPictures: Int) {
self.state = state
self.pubkeys = pubkeys
self.maxPictures = min(maxPictures, pubkeys.count)
}
var body: some View {
// Using ZStack to make profile pictures floating and stacked on top of each other.
ZStack {
ForEach((0..<maxPictures).reversed(), id: \.self) { index in
ProfilePicView(pubkey: pubkeys[index], size: 32.0, highlight: .none, profiles: state.profiles, disable_animation: state.settings.disable_animation)
.offset(x: CGFloat(index) * 20)
}
}
// Padding is needed so that other components drawn adjacent to this view don't get drawn on top.
.padding(.trailing, CGFloat((maxPictures - 1) * 20))
}
}
struct CondensedProfilePicturesView_Previews: PreviewProvider {
static var previews: some View {
CondensedProfilePicturesView(state: test_damus_state(), pubkeys: ["a", "b", "c", "d"], maxPictures: 3)
}
}