conversations-classic-ios/ConversationsClassic/View/SharedComponents/SharedListRow.swift

60 lines
1.8 KiB
Swift
Raw Normal View History

2024-06-19 15:15:27 +00:00
import SwiftUI
2024-08-07 19:07:39 +00:00
enum SharedListRowIconType {
case charCircle(String)
case image(Image, Color)
2024-06-19 15:15:27 +00:00
}
2024-08-07 19:07:39 +00:00
struct SharedListRow: View {
let iconType: SharedListRowIconType
let text: String
var body: some View {
VStack(spacing: 0) {
HStack(spacing: 8) {
// Icon
switch iconType {
case .charCircle(let str):
let char = str.firstLetter
let color = str.firstLetterColor
ZStack {
Circle()
.frame(width: 44, height: 44)
.foregroundColor(color)
Text(char)
.foregroundColor(.white)
.font(.body1)
}
case .image(let image, let color):
ZStack {
Circle()
.frame(width: 44, height: 44)
.foregroundColor(.clearTappable)
.overlay {
image
.foregroundColor(color)
}
}
}
// Text
Text(text)
.foregroundColor(Color.Material.Text.main)
.font(.body2)
Spacer()
}
.padding(.horizontal, 16)
.padding(.vertical, 4)
Rectangle()
.frame(maxWidth: .infinity)
.frame(height: 1)
.foregroundColor(.Material.Background.dark)
}
.listRowInsets(.zero)
.listRowSeparator(.hidden)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.Material.Background.light)
2024-06-19 15:15:27 +00:00
}
}